Computer Science Canada

Reading From .txt files and displaying the info in a combobox

Author:  Darkmantis [ Fri Feb 09, 2007 11:21 am ]
Post subject:  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 Confused . A tutorial or a bit of advice would be nice.

Author:  Darkmantis [ Mon Feb 12, 2007 10:17 am ]
Post subject:  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

Author:  wtd [ Mon Feb 12, 2007 8:45 pm ]
Post subject:  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?

Author:  Silent Avenger [ Mon Feb 12, 2007 9:46 pm ]
Post subject:  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. Smile http://www.compsci.ca/v3/viewtopic.php?t=15004

Author:  Darkmantis [ Tue Feb 13, 2007 11:07 am ]
Post subject:  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:
code:

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..

code:

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

code:
Global nme (20), numrecords

Author:  Silent Avenger [ Thu Feb 15, 2007 10:33 am ]
Post subject:  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?

Author:  Darkmantis [ Thu Feb 15, 2007 1:41 pm ]
Post subject:  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 Smile
If any one wants to see my code or wants a tutorial just let me now. Very Happy


: