|
-
Nov 6th, 2000, 08:42 AM
#1
Thread Starter
Lively Member
Can anybody tell this newbie how to view the contents of a file; how to view the contents of the autoexec.bat in a scrolling textbox? Please?
-
Nov 6th, 2000, 08:51 AM
#2
Frenzied Member
Add this to your form, add a textbox with the scrollbar property to 2. Both
Code:
Private Sub Form_Load()
Dim tmp$, fn%
fn = FreeFile
Open "c:\autoexec.bat" For Input As #fn
Input #fn, tmp
Close #fn
Text1 = tmp
End Sub
Jop - validweb.nl
Alcohol doesn't solve any problems, but then again, neither does milk.
-
Nov 6th, 2000, 08:52 AM
#3
OK follow these steps.[*]Put a textbox on a form and set the MultiLine property to True[*]Optionally you can set the ScrollBars property[*]In code get a free file number by calling FreeFile[*]Open the file for Input[*]Read the contents and assign it to the TextBox[*]Close the file
Code:
Private Sub Command1_Click()
Dim iFile As Integer
iFile = FreeFile
Open "C:\AutoExec.Bat" For Input As #iFile
Text1 = Input(LOF(iFile), iFile)
Close #iFile
End Sub
Good luck!
-
Nov 6th, 2000, 09:09 AM
#4
Thread Starter
Lively Member
Thanx
Thank you... it's sort of the same as QB. Only Qbasic doesn't work with objects and stuff.
-
Nov 6th, 2000, 04:08 PM
#5
Originally posted by Jop
Add this to your form, add a textbox with the scrollbar property to 2. Both
Code:
Private Sub Form_Load()
Dim tmp$, fn%
fn = FreeFile
Open "c:\autoexec.bat" For Input As #fn
Input #fn, tmp
Close #fn
Text1 = tmp
End Sub
Code is all messed up Jop.
Code:
Private Sub Command1_Click()
Dim strLine$
Open "c:\autoexec.bat" For Input As #1
Do While Not EOF(1)
Line Input #1, strLine$
Text1.Text = Text1.Text & strLine$ & vbCrLf
Loop
Close #1
End Sub
All fixed up for ya .
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
|