On Jun 19, 2006, at 1:45 PM, Charles Yeomans wrote:
You cast the reference to the correct type.
For i as Integer = 0 to self.ControlCount - 1
If Control(i) IsA EditField then
...
ElseIf Control(i) IsA PopupMenu then
...
ElseIf ...
Else
End if
Next
But I don't see a good way to make your approach work in
general. For example, suppose you have a PopupMenu. How does
one know whether its values represent tables or fields? You can
begin writing subclasses of controls like SQLTablePopupMenu...
I've got a module method that extracts the data from things like
Popup Menus. I'll be passing such a control to that module to get
a return value for the value contained therein.
My current challenge is trying to get the data from a simple
EditField. I'll tackle the others as I get to them. And, where you
put the ellipsis is where I'm not figuring it out.
If Control(i) IsA EditField then
dim theText as String = EditField(Control(i)).Text
The bit EditField(Control(i)) is called "typecasting". You're
telling the compiler to treat the reference returned by Control(i)
as an EditField. If Control(i) is not an EditField, then the
runtime framework will raise an IllegalCastException, which is why
one tests first.
I thought there'd be SOME way to cast a control but I could find no
reference to it in the Language Ref.
Also, I couldn't find much information with respect to the utility of
the HANDLE property of a Control. Is there any information on how one
can use such items?
Regards,
Chuck
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>