| 'Open
New Project.Add Module and write down this public
function on it. Public Declare Function FindFirstFile Lib "kernel32" Alias "FindFirstFileA" (ByVal lpFileName As String, lpFindFileData As WIN32_FIND_DATA) As Long Public Const MAX_PATH = 260 Public Type FILETIME dwLowDateTime As Long dwHighDateTime As Long End Type Public Type WIN32_FIND_DATA dwFileAttributes As Long ftCreationTime As FILETIME ftLastAccessTime As FILETIME ftLastWriteTime As FILETIME nFileSizeHigh As Long nFileSizeLow As Long dwReserved0 As Long dwReserved1 As Long cFileName As String * MAX_PATH cAlternate As String * 14 End Type 'Put one label,one textbox and on button on the form.Write down the codes below on it. Private Sub Command1_Click() Dim c As WIN32_FIND_DATA If Not Text1.Text = "" Then t& = FindFirstFile(Trim(Text1.Text), c) If t& = -1 Then MsgBox "The file isn't found in that directory", , "Warning" Else MsgBox "We found it", , "Message" End If End If End Sub Private Sub Form_Load() Label1.FontSize = 12 Label1.FontBold = True Label1.Caption = "Enter File Name " Text1.FontSize = 12 Text1.FontBold = True Text1.Text = "" Command1.Caption = "Find It!" End Sub
|