G
Gary Kahrau
I hope this is a simple question.
I have a number of usercontrols placed on a form. The usercontrol has
a public property (DispMachine) within it. When looping through the
main form controls, I get an error (not a member of
system.windows.forms.control). However if I put in the explicit name,
VB is happy.
Is it possible to get to this property dynamically?
Or do I have to create a select case (ugly) structure?
For n = 0 To Me.Controls.Count - 1
If Me.Controls(n).GetType.ToString.EndsWith("MachControl") Then
tmpStr = Me.Controls(n).Tag
tmpStr2 = Me.Controls(n).Name
If InStr(tmpStr, vbReader.Item("machine"),
CompareMethod.Text) Then
Me.Controls(n).DispMachine = tmpStr <==== Error
Me.MachControl1.DispMachine = tmpStr <==== Works
End If
End If
Next
I have a number of usercontrols placed on a form. The usercontrol has
a public property (DispMachine) within it. When looping through the
main form controls, I get an error (not a member of
system.windows.forms.control). However if I put in the explicit name,
VB is happy.
Is it possible to get to this property dynamically?
Or do I have to create a select case (ugly) structure?
For n = 0 To Me.Controls.Count - 1
If Me.Controls(n).GetType.ToString.EndsWith("MachControl") Then
tmpStr = Me.Controls(n).Tag
tmpStr2 = Me.Controls(n).Name
If InStr(tmpStr, vbReader.Item("machine"),
CompareMethod.Text) Then
Me.Controls(n).DispMachine = tmpStr <==== Error
Me.MachControl1.DispMachine = tmpStr <==== Works
End If
End If
Next