I created a collection of controls in my form. Now, read through each control of the form to get the control name and its index number. Not all the controls in my form was defined as control array. Now my problem is how can I determine if the control that was being read through my For...Next statement has an Array Number or None. Below is the code I created.
Dim oControl As Control
dim sParamName as string
dim iIndexNo as integer
For Each oControl In Controls
If TypeOf oControl Is TextBox Then
If oControl.Visible Then
sParamName = oControl.Name
iIndexNo = oControl.Index
End If
end if
Next
When the compiler read this statement below
iIndexNo = oControl.Index
it gets error when that control has no array element. How could I trap or identify if it has an array element or none.
Any help would be highly appreciated.
JBats
Good is not better if not than best...
Dim oControl As Control
dim sParamName as string
dim iIndexNo as integer
For Each oControl In Controls
If TypeOf oControl Is TextBox Then
If oControl.Visible Then
sParamName = oControl.Name
iIndexNo = oControl.Index
End If
end if
Next
When the compiler read this statement below
iIndexNo = oControl.Index
it gets error when that control has no array element. How could I trap or identify if it has an array element or none.
Any help would be highly appreciated.
JBats
Good is not better if not than best...