R
Rich
Hi
I have five check boxes in a windows form. They are called chkEQUDS01,
chkEQUDS02, chkEQUDS03, chkEQUDS04, and chkEQUDS05. I am getting the text
name for the check boxes from a datatable and have wrote the code below:
If dtEq.Rows(0).Item(2) = 1 Then
chkEQUDS01.Enabled = True
chkEQUDS01.Text = dtEq.Rows(0).Item(1)
End If
If dtEq.Rows(1).Item(2) = 1 Then
chkEQUDS02.Enabled = True
chkEQUDS02.Text = dtEq.Rows(1).Item(1)
End If
If dtEq.Rows(2).Item(2) = 1 Then
chkEQUDS03.Enabled = True
chkEQUDS03.Text = dtEq.Rows(2).Item(1)
End If
If dtEq.Rows(3).Item(2) = 1 Then
chkEQUDS04.Enabled = True
chkEQUDS04.Text = dtEq.Rows(3).Item(1)
End If
If dtEq.Rows(4).Item(2) = 1 Then
chkEQUDS05.Enabled = True
chkEQUDS05.Text = dtEq.Rows(4).Item(1)
End If
If dtEq.Rows(5).Item(2) = 1 Then
chkEQUDS06.Enabled = True
chkEQUDS06.Text = dtEq.Rows(5).Item(1)
End If
Can anyone tell me if there is a better way to write this? In particular,
how could I create an integer and then refer to a name and the integer which
make up the chkbox name, for example, chkEQUDi and as you password round
each loop i would increase by 1.
Hope this makes some sense?
Thanks
Rich
I have five check boxes in a windows form. They are called chkEQUDS01,
chkEQUDS02, chkEQUDS03, chkEQUDS04, and chkEQUDS05. I am getting the text
name for the check boxes from a datatable and have wrote the code below:
If dtEq.Rows(0).Item(2) = 1 Then
chkEQUDS01.Enabled = True
chkEQUDS01.Text = dtEq.Rows(0).Item(1)
End If
If dtEq.Rows(1).Item(2) = 1 Then
chkEQUDS02.Enabled = True
chkEQUDS02.Text = dtEq.Rows(1).Item(1)
End If
If dtEq.Rows(2).Item(2) = 1 Then
chkEQUDS03.Enabled = True
chkEQUDS03.Text = dtEq.Rows(2).Item(1)
End If
If dtEq.Rows(3).Item(2) = 1 Then
chkEQUDS04.Enabled = True
chkEQUDS04.Text = dtEq.Rows(3).Item(1)
End If
If dtEq.Rows(4).Item(2) = 1 Then
chkEQUDS05.Enabled = True
chkEQUDS05.Text = dtEq.Rows(4).Item(1)
End If
If dtEq.Rows(5).Item(2) = 1 Then
chkEQUDS06.Enabled = True
chkEQUDS06.Text = dtEq.Rows(5).Item(1)
End If
Can anyone tell me if there is a better way to write this? In particular,
how could I create an integer and then refer to a name and the integer which
make up the chkbox name, for example, chkEQUDi and as you password round
each loop i would increase by 1.
Hope this makes some sense?
Thanks
Rich