Hi all
im trying to get value of a constructed checkbox.checkstate value

For i = 1 To 19
Dim scheckBox As String = "checkBox" & i & ".checkstate"
dim int as integer = scheckBox '

in foxpro:

any ideas???

So youve created a load of new checkboxes on the fly and then you want to go through each one and check if it has been checked?

To see if a checkbox is checked in VB.net (and VB too) you need to do something like this:

IF MyCheckBox.Checked Then
  'i.e MyCheckBox.Checked = true
  'Not checked i.e. MyCheckBox.Checked =False
End If

To parse through the checkboxes you are going to have to grab their parent object (e.g. Form or Groupbox etc) and use something like Findcontrol to find each one:

dim sCheckBox as String
dim iCheckBox as Checkbox
dim MyState as Boolean
for i = 1 to 9
 sCheckBox = "checkbox" &i
 iCheckbox = Form.FindControl(sCheckBox)
 if iCheckbox isnot nothing then
    MyState = iCheckbox.Checked
 end if  

but find control isnot a property of form

You should parse through the forms control collection or alternatively if you put them in another container through that.

I'm sorry I was talking about findcontrol, I was just giving you a rough idea off the top of my head, I'll not bother next time.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.18 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.