I think you are confusing the name of the checkbox and the reference to
the checkbox, you cannot just use the name of the checkbox to access
it's members as you suggest. Instead, you need the reference to the
checkbox.
So Asad was basically correct.
Dim cbx As checkbox
'Get a reference to the cbx named checkbox1 within panel1
For c as control in panel1.controls
If typeof(c) is checkbox then
cbx = c
If cbx.Name = "checkbox1" then
Exit For
Else
cbx = Nothing
End If
End If
Next
If Not cbx Is Nothing Then
If cbx.Checked then
'checkbox named checkbox1 is checked so do whatever here.
End if
End If
Andy
Mike Fellows wrote:
maybe you should read before posting
and atleast attempt to spell correctly
the checkbox names i gave where an example
and the for loop is fairly obvious, but again that was not my question!
<as********@gma il.comwrote in message
news:11******** **************@ m79g2000cwm.goo glegroups.com.. .
use a for loop
and before this name ur controls prperly.
Asad
Mike Fellows wrote:
I have created some checkboxes within a panel using the code below
Dim NewCheckbox As New CheckBox
Me.Panel2.Contr ols.Add(NewChec kbox)
NewCheckbox.Loc ation = New Point(XLocation , YLocation)
NewCheckbox.Aut oSize = True
NewCheckbox.Tex t = DS1.Tables(0).R ows(counter1)(0 )
NewCheckbox.Nam e = "Checkbox" & counter1 + 1
the problem I have is how do i access the value of that checkbox?
(usually
it would be just checkbox1.check ed, but obvioulsy this does not work)
Thanks
Mike Fellows