|
-
Jun 10th, 2003, 06:43 PM
#1
Thread Starter
New Member
Write/Read Commands
Hey All,
I need to know the basic code on how to write to a text file using a textbox, and then retrieve it back when i do a search from a texbox.
Any help would be great
Thanks Jason
-
Jun 10th, 2003, 06:51 PM
#2
Fanatic Member
To write to the file:
VB Code:
Open "C:\test.txt" For Output As #1
Print #1, "Say something here"
Close #1
I don't remember the code for retrieving from the text file, as I haven't found much use for it ever since I found the RichTextBox.SaveFile and RichTextBox.LoadFile functions.
My advice would be to use the rich text box instead, it's much easier.
-
Jun 10th, 2003, 07:48 PM
#3
Thread Starter
New Member
Thanks hothead.
On your advise what would be the code to write/read to this richtextbox.
example for writing
======================
Open "C:\test.tft" For Output As #1
Print #1, "Say something here"
Close #1
=======================
How would you read ??
Thanks
-
Jun 10th, 2003, 08:00 PM
#4
Frenzied Member
You could do something like:
Dim strYourText As String
Open "C:\detlog.txt" For Input As #1
Do Until EOF(1) = True
Input #1, strYourText
Text1.Text = Text1.Text & strYourText
Loop
All depends on how you want to read it.
-
Jun 10th, 2003, 09:47 PM
#5
Fanatic Member
The syntax to write to a file using a rich text box is different from that of a regular text box. It would be something like this:
VB Code:
RichTextBox1.SaveFile App.Path & "\Test.txt", RTF_TEXT
And here's how to read from the file:
VB Code:
RichTextBox1.LoadFile App.Path & "\Test.txt", RTF_TEXT
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|