gomindi Posted January 2, 2003 Posted January 2, 2003 I've come across another delima. I have written to a textfile, but I need a "separator" so that my data can be read into my text boxes. Can somebody please help me?! I am lost:( Thanks! Mindi Quote
*Experts* Volte Posted January 2, 2003 *Experts* Posted January 2, 2003 What's the format of your textfile right now? Can you paste an excerpt from it so that I know exactly what you need? Quote
gomindi Posted January 2, 2003 Author Posted January 2, 2003 the format is simply a text file. .txt thisistochecktoseeifthiscreatesanewfile I want each word(I typed each word into a separate text box, write to a file) and now I want each word to show up on a form, each in it's own text box. Quote
*Experts* Volte Posted January 2, 2003 *Experts* Posted January 2, 2003 Oh, ok. Then when you write the text file, add some delimeter (a comma, or something; make sure it doesn't appear in any of the words you want to retrieve from the file). So your file might looks like this: The,quick,brown,fox,jumps,over,the,lazy,dog When you read the textfile, read it all in at once, and use the Split function of the string you read it into, like Dim words() As String Dim fileIn As String 'Read your file into the fileIn variable here words = fileIn.Split(",")And now you will be left with words(), an array of strings containing all of the words from your text file. Loop through them and do whatever you wish with them (adding them to textboxes, I guess). Quote
gomindi Posted January 2, 2003 Author Posted January 2, 2003 Uh, I am a beginner (as if you couldn't tell!) but could you maybe help me with the code for read your file into the filein variable portion? Sorry I know this is probably super menial to you. But I really appreciate your help!!! THanks! Mindi Quote
*Experts* Volte Posted January 2, 2003 *Experts* Posted January 2, 2003 Try something like this:Dim fileIn As String Dim sr As New IO.StreamReader("C:\file.txt") fileIn = sr.ReadToEnd() sr.Close() Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.