Can anyone tell me the exact code
line by line
for entering the file name in a text box
and file exists
else msg box "File Not Found"
if a file name r.txt s entered in text box it should
display the message it exists else Not Found
Regds
Sam F.
Printable View
Can anyone tell me the exact code
line by line
for entering the file name in a text box
and file exists
else msg box "File Not Found"
if a file name r.txt s entered in text box it should
display the message it exists else Not Found
Regds
Sam F.
This will only work in the current directory, will not search all drivers and directories!
VB Code:
Private Sub Command1_Click() If Not (Len(Dir$(Text1.Text)) <> 0) Then MsgBox ("The File Does not exist") Else MsgBox ("The File exists") End If End Sub
I hope its what you were looking for :)
I think this makes more sence :D
VB Code:
Private Sub Command1_Click() If (Len(Dir$(Text1.Text)) = 0) Then MsgBox ("File Not Found") Else MsgBox ("File Found") End If End Sub
If (Len(Dir$(Text1.Text)) = 0) Then
MsgBox ("File Not Found")
Else
MsgBox ("File Found")
End If
whenever i type a anyting it gives MSGbox File Not Found
Regds
Sam F.
This code will only detect the filename you type in the same directory you save this program in.Quote:
Originally posted by samf
If (Len(Dir$(Text1.Text)) = 0) Then
MsgBox ("File Not Found")
Else
MsgBox ("File Found")
End If
whenever i type a anyting it gives MSGbox File Not Found
Regds
Sam F.