| | |
Open file VB6
![]() |
•
•
Join Date: Aug 2009
Posts: 30
Reputation:
Solved Threads: 0
I am using a MDI Form and several documents can be opened using
"CommonDialog1.ShowOpen"
If i open a file then go back to open another file but click cancel or the "x" then it will open the last file.
so i need to know how to clear the "#1"
my code it:
Any ideas
I have cleared the "FileName" and "Data" but it still does it so i need to find a way to stop it.
"CommonDialog1.ShowOpen"
If i open a file then go back to open another file but click cancel or the "x" then it will open the last file.
so i need to know how to clear the "#1"
my code it:
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
FileName = "" Data = "" MDIForm1.CommonDialog1.Filter = "All Files(*.*)|*.*|Text Files(*.txt)|*.txt|Web Files(*.html;*.htm;*.shtml;*.shtm;*.xhtml;*.php;*.php3;*.phtml;*.css;*.js;)|*.html;*.htm;*.shtml;*.shtm;*.xhtml;*.php;*.php3;*.phtml;*.css;*.js;|Batch Files(*.bat;*.cmd;*.nt;)|*.bat;*.cmd;*.nt;|VB Files(*.vb;*.vbs;*.frm;*.vbp;)|*.vb;*.vbs;*.frm;*.vbp;" On Error GoTo error MDIForm1.CommonDialog1.ShowOpen Me.Caption = MDIForm1.CommonDialog1.FileTitle FileName = MDIForm1.CommonDialog1.FileName Open FileName For Input As #1 Do Until EOF(1) Input #1, Data Me.Text1.Text = Me.Text1.Text + Data + vbCrLf EOF (1) Loop Close #1 FileName = "" Data = "" GoTo endload
Any ideas
I have cleared the "FileName" and "Data" but it still does it so i need to find a way to stop it.
Last edited by drabsch; 14 Days Ago at 1:25 am.
•
•
Join Date: Mar 2009
Posts: 800
Reputation:
Solved Threads: 146
1
#3 13 Days Ago
two different ways are shown in the following...
Good Luck
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
Option Explicit Private Sub Command1_Click() OpenShowFile End Sub Private Sub OpenShowFile() On Error GoTo OpenShowFileError Dim FName As String, FNumb As Integer Dim FileContents As String CD.CancelError = True CD.Filter = "Text Files *.txt|*.txt" CD.FileName = vbNullString CD.ShowOpen If CD.FileName = vbNullString Then Exit Sub FName = CD.FileName FNumb = FreeFile Open FName For Input As #FNumb FileContents = Input(FileLen(FName), #FNumb) Close #FNumb Text1.Text = FileContents Exit Sub OpenShowFileError: If Err.Number = 32755 Then Exit Sub 'user pressed cancel End Sub
Good Luck
If anyone has helped you solve your problem, please mark your thread as solved.
Thanks
Thanks
![]() |
Similar Threads
- How to convert a .pptx / .pptm file (PowerPoint presentation) to .ppsm file using VB6 (Visual Basic 4 / 5 / 6)
- open, read and write a msword file in vb6 (Visual Basic 4 / 5 / 6)
- Doubleclick to open file. (C#)
- Can seem to open my file (C++)
- open a file and divide its data in arrays (C)
- how to create swf file in vb6 from bmp imgs in directory and wav file (Visual Basic 4 / 5 / 6)
- Opening An Adobe File In Vb6 (Visual Basic 4 / 5 / 6)
- Open any file and List. (Visual Basic 4 / 5 / 6)
- Cannot open file : a (Windows 95 / 98 / Me)
Other Threads in the Visual Basic 4 / 5 / 6 Forum
- Previous Thread: get the databse table names
- Next Thread: How ca i read from Bar code using VB
| Thread Tools | Search this Thread |
* 6 429 2007 access activex add age application basic beginner birth bmp calculator cd cells.find click client code college component connection connectionproblemusingvb6usingoledb copy creat ctrl+f data database datareport date delete dissertations dissertationthesis dissertationtopic edit error excel excelmacro file filename form hardware header iamthwee image inboxinvb internetfiledownload keypress label listbox listview liveperson login looping machine microsoft movingranges number objectinsert open oracle password prime program prompt range-objects readfile reading record refresh remotesqlserverdatabase report save search sendbyte sites sort sql sql2008 sqlserver subroutine tags textbox time urldownloadtofile vb vb6 vb6.0 vba visual visualbasic visualbasic6 web window windows





