|
-
Jan 31st, 2004, 06:29 PM
#1
Thread Starter
Hyperactive Member
opening a text file in VB *** Resolved***
I am trying to make a text editor in VB. I have a text box on a form and a common dialog box. How do i get the file to open in that text box
Last edited by fasi; Jan 31st, 2004 at 06:36 PM.
-
Jan 31st, 2004, 06:30 PM
#2
Frenzied Member
Do a search for reading text files.
-
Jan 31st, 2004, 06:31 PM
#3
VB Code:
With CommonDialog1
.Filter = "Text Files|*.txt"
.ShowOpen
Open .FileName For Input As #1
Do While Not EOF(1)
Input #1, line
Text1.Text = Text1.Text & line & vbNewLine
Loop
Close #1
End With
Hope this helps..
Phreak
Visual Studio 6, Visual Studio.NET 2005, MASM
-
Jan 31st, 2004, 06:36 PM
#4
Thread Starter
Hyperactive Member
-
Jan 31st, 2004, 06:36 PM
#5
Junior Member
VB Code:
Dim intFile As Integer
On Error GoTo No_Open
intFile = FreeFile
With cdlFiles
.Filter = "Files(*.txt)|*.txt"
.DefaultExt = "txt"
.DialogTitle = "Open File"
.Flags = cdlOFNFileMustExist + cdlOFNPathMustExist
.ShowOpen
End With
Open cdlFiles.FileName For Input As intFile
rtfPad.Text = Input(LOF(1), intFile)
Close intFile
Exit Sub
No_Open:
End Sub
-
Feb 15th, 2004, 06:22 AM
#6
Supreme User
Doesnt work for me
VB Code:
Public Sub OpenDocument()
On Error GoTo No_Open
dlgOpen.ShowOpen
Open dlgOpen.FileName For Input As #1
Do While Not EOF(1)
Input #1, Line
txtMain.Text = txtMain.Text & Line & vbNewLine
Loop
Close #1
Exit Sub
No_Open:
Me.Refresh
txtMain.SetFocus
End Sub
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
|