
-----------------------------------
Darkmantis
Fri Feb 09, 2007 11:21 am

Reading From .txt files and displaying the info in a combobox
-----------------------------------
Can some1 plz point me in the right direction with this plz, I've done this before just can't remember it :? . A tutorial or a bit of advice would be nice.

-----------------------------------
Darkmantis
Mon Feb 12, 2007 10:17 am

Re: Reading From .txt files and displaying the info in a combobox
-----------------------------------
Is there anyone that will point me in the right direction or u just gong to leave me in the dark? xD

-----------------------------------
wtd
Mon Feb 12, 2007 8:45 pm

RE:Reading From .txt files and displaying the info in a combobox
-----------------------------------
You question is best broken into a set of smaller problems.

How would you read lines from a text file?

How would you insert a string into a combo box?

-----------------------------------
Silent Avenger
Mon Feb 12, 2007 9:46 pm

Re: Reading From .txt files and displaying the info in a combobox
-----------------------------------
Try looking around harder in the help forums because the answer may be right under your nose. :)  http://www.compsci.ca/v3/viewtopic.php?t=15004

-----------------------------------
Darkmantis
Tue Feb 13, 2007 11:07 am

Re: Reading From .txt files and displaying the info in a combobox
-----------------------------------
I got my program to read txt files and add them to my combo box earlier before ur post,
this is the code i used:

Private Sub Form_Load()
WebBrowser1.Navigate ("http://www.google.ca")
Open "h:/sites.txt" For Input As #1
numrecords = 1
While Not (EOF(1))
Line Input #1, nme(numrecords)
text1.AddItem nme(numrecords)
numrecords = numrecords + 1
Wend
Close #1
numrecords = numrecords - 1
End Sub

but right now im stuck because I want to be able to save info to the text file also, this is the code I have right now, its some coding my teacher taught me like 2 years ago. Cant get it to work though..


Private Sub cmdgo_Click()
WebBrowser1.Navigate (text1.Text)
Open "h:/sites.txt" For Output As #1
For i = 1 To numrecords
Print #1, nme(i)
Next
Close #1
End Sub

the nme is a global value same with the numrecords I put them in a module

 Global nme (20), numrecords 

-----------------------------------
Silent Avenger
Thu Feb 15, 2007 10:33 am

Re: Reading From .txt files and displaying the info in a combobox
-----------------------------------
Well what does the data in the file look like when you save and open it in word?

-----------------------------------
Darkmantis
Thu Feb 15, 2007 1:41 pm

Re: Reading From .txt files and displaying the info in a combobox
-----------------------------------
I got my coding to work now I can open, access and save .txt files :)
If any one wants to see my code or wants a tutorial just let me now.  :D
