lunaclover
Programmer
- Jun 22, 2005
- 54
Okay - I have this form (form1) with lots of radiobuttons, comboboxes and textboxes. On this form, there is a button that loads form2 with
Dim frmAccessories As New Form2a
frmAccessories.Show()
So far so good. Then in the code for form2 I want it to recognize the state of the controls on form 1 and when form2 loads it show/hide its own controls appropriately. For example on form2_load(byval...) handles mybase.load
I want to be able to say
If form1.radiobutton1.checked = true then
chk1.enabled = true
chk2.enabled = false
.
.
end if
chk1 and chk2 are checkboxes on form2. radiobutton1 is on form1.
I tried saying 'dim form2 as new form1' so it would inherit all form1's controls, and it seems to work (i.e. there is no squiggely blue line underneath radiobutton1, and the intellisense works and brings up controls from form1, like radiobutton1, for example) but then when I run it with a break to see what it's doing, it says 'radiobutton1.checked = false' when really it is checked, and should say 'true' and proceed with the if statement.
Why does it not see that it is checked? I am loading form2 from a button on form1.
Is my dim statement wrong somehow? I've tried changing it and it gets mad at me and insults me. Any suggestions would REALLY be appreciated!
Thanks!
LunaClover
Dim frmAccessories As New Form2a
frmAccessories.Show()
So far so good. Then in the code for form2 I want it to recognize the state of the controls on form 1 and when form2 loads it show/hide its own controls appropriately. For example on form2_load(byval...) handles mybase.load
I want to be able to say
If form1.radiobutton1.checked = true then
chk1.enabled = true
chk2.enabled = false
.
.
end if
chk1 and chk2 are checkboxes on form2. radiobutton1 is on form1.
I tried saying 'dim form2 as new form1' so it would inherit all form1's controls, and it seems to work (i.e. there is no squiggely blue line underneath radiobutton1, and the intellisense works and brings up controls from form1, like radiobutton1, for example) but then when I run it with a break to see what it's doing, it says 'radiobutton1.checked = false' when really it is checked, and should say 'true' and proceed with the if statement.
Why does it not see that it is checked? I am loading form2 from a button on form1.
Is my dim statement wrong somehow? I've tried changing it and it gets mad at me and insults me. Any suggestions would REALLY be appreciated!
Thanks!
LunaClover