It sounds as if you may have a situation in which you must cycle through the
controls, check each to see if it is one whose contents should be written to
the file, and if so, write it's contents. This requires a cast, since the
control class doesn't have a text property.
For i = 0 to Window1.ControlCount - 1
If Control(i) IsA EditField then
FileStream.WriteLine EditField(Control(i)).text
Next
End if
This can be a good situation for using class interfaces if you are dealing
with a subset of various writable controls.
Jack
> I'm trying to write the text property from various controls to a text
> file using a for - next loop.
>
> Here is the code I have come up with so far:
>
> For i = 0 to Counter
> FileStream.WriteLine
> Next
>
> My problem is I cannot figure out what comes after FileStream.WriteLine.
> I've written to files before but always used this construction -
> FileStream.WriteLine EditField1.text. Since I have an unknown number of
> controls I wanted do a loop instead. I know it should be very simple but
> whatever I try gives me a compiler error, usually Type Mismatch.
- - -
Unsubscribe or switch delivery mode:
<http://support.realsoftware.com/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>
|