I have the following for each loop which loops through a registry key and reads all the values:
What I am trying to have been highlighted in bold.. Each time the loop executes and reads a value from the registry, I want the code to create a checkbox which has a unique name and text according to the value that was read... So the number of checkboxes will depend on number of values that is got from the registry...
Dim returnValue As RegistryKey = Registry.LocalMachine.OpenSubKey("SOFTWARE\Microsoft\Windows\CurrentVersion\Run")
Dim keyname As String = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run"
Dim values() As String = returnValue.GetValueNames
Dim value As String
Dim message As String = ""
For Each value In values
Dim readvalue As String
readvalue = Registry.GetValue(keyname, value, Nothing)
message &= value & " : " & readvalue & vbNewLine
Dim chkb As New CheckBox
Dim chkboxname As String = "chkbox" & value
Dim text As String = value & " : " & readvalue
chkb.Text = text
chkb.Name = chkboxname
' for testing, comment this out
But this doesn't work. It only creates one text box and the text of the textbox is also incomplete...
Can u please tell me what is wrong?