|
-
Oct 18th, 2000, 04:45 PM
#1
Thread Starter
Lively Member
how can i open a file using a common dialogue instead of doing it this way:
____________________________________
Dim i As Integer
Dim temp As String
i = 0
CountAges = 0
Open "a:\data.txt" For Input As #1
i = i + 1
Input #1, Names(i), Ages(i)
CountAges = i
_________________________________
how do bring up the open dialogue box instead of accessing the file directly????
-
Oct 18th, 2000, 04:58 PM
#2
Code:
Private Sub Command1_Click()
Dim iFile As Integer
On Error GoTo User_Cancelled
With CommonDialog1
.CancelError = True
.DialogTitle = "Select a Text File.."
.Filter = "Text (*.txt)|*.txt"
.ShowOpen
iFile = FreeFile
Open .filename For Input As iFile
Text1.text = Input(LOF(iFile), iFile)
Close iFile
End With
User_Cancelled:
End Sub
-
Oct 18th, 2000, 05:00 PM
#3
add the common dialog component to your project, put a common dialog control on your form and have something like:
Code:
Private Sub open_Click()
CommonDialog1.ShowOpen
'Set somekind of filter unless you want all files to show up
Open CommonDialog1.FileName For Input As #1
'And the rest of your code
that should work.
-
Mar 12th, 2002, 07:40 AM
#4
New Member
COMMON DIALOGUE HELP PLEASE
hi,
I WANT THE FILE TO OPEN FOR THE USER TO EDIT WHEN HE CLICKS ON THE OPEN BUTTON IN THE COMMON DIALOGUE BOX OR WHEN HE DOUBLE CLICKS ON THE FILE.I SEARCHED ALL OF MSDN BUT IN VEIN CAN ANYBODY HELP ME WITH THIS PLEASE
ASHRAF
-
Mar 12th, 2002, 07:41 AM
#5
-= B u g S l a y e r =-
what kind of files are we talking about here?
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
|