Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VBDOS Expertise Still Alive? Looking for assistance with loading a text file into a text box.

jejump

Programmer
Jan 12, 2025
2
It seems a bit of a reach to think there's any expertise left for VBDOS v1.0. I don't know how much there ever really was in the first place. I've been playing around with multi-line text boxes and text files. I found this example online for some flavor of VB for moving text from a box into a file:

OPEN "C:\VBD\TEST.TXT" FOR OUTPUT AS #1

PRINT #1, Text1.Text
CLOSE #1

Very simple and very effective! This example isn't in the help file, that I've been able to find. I need to learn how to do the opposite of this, too. Changing OUTPUT to INPUT and PRINT# to INPUT# doesn't seem to be the way. Any expertise or thoughts would be greatly appreciated.

Thanks,
-John
 
Through much trial and mostly error, I was able to figure out this method. It works, but I'm sure there's a more appropriate way of doing this.

OPEN "C:\PATH\FILENAME.TXT" FOR BINARY AS #1
A=1
DO WHILE NOT EOF(1)
GET #1, A, D%
D% = D% AND &HFF
IF D% <> 10 THEN Text1.Text = Text1.Text + CHR$(D%)
A = A + 1
LOOP
CLOSE #1

If this routine is allowed to run without omitting LF (line feed character, 10) from the text box, it somehow disregards the multi-line aspect of the Text1.Text box and writes every line of the file to the first line of the text box, each subsequent line overwriting the previous line.

Maybe someday, someone will find this info useful.

Jj
 

Part and Inventory Search

Sponsor

Back
Top