0

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 '

Next
---------------------------------------------------------------
in foxpro:
-------------
int=&(scheckBox)

any ideas???
thanks

2
Contributors
3
Replies
4
Views
7 Years
Discussion Span
Last Post by G_Waddell
0

Hi
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
Else
  '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  
next
0

Hi,
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.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.