At 8:54 PM -0500 6/30/04, Maury McCown wrote:
Hey all
Time for another embarrassing question about something I should already know
how to do: generate a menu containing a list from a data file.
I have a text file with a list of city names, and when the app starts, I
want to load the list of names into my Locations menu item. However, all I
can get it to do is load the last item in the list - and I've tried all
kinds of stuff to try and get this to work, but I can't. =(
Here's my code (c is dimmed as new MenuItem):
File = blablabla....
input = file.OpenAsTextFile
do until input.EOF
c.Text = input.ReadLine
MenuBar1.Child("LocationsMenu").Insert(0,c)
Loop
input.Close
All this does is list the last item in the file for each instance of an
item.
Any help would be appreciated!
I just tried the following in the Open event of a test application,
with success. It ought to get you back on track:
dim i, u As Integer
dim item As MenuItem
dim menu As MenuItem
const s = "Arizona, California, Montana, Colorado, Utah, Idaho, Washington"
menu = MenuBar1.Child("LocationsMenu")
u = CountFields(s, ",")
for i = 1 to u
item = new MenuItem
item.Text = NthField(s, ",", i)
menu.Append Item
Next
_______________________________________________
Unsubscribe or switch delivery mode:
<http://support.realsoftware.com/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>
|