How Check For a File - Bagaimana Mengecek sebuah File

Contoh berikut adalah contoh bagaiman mengecek sebuah file. Code dibuat sangat sederhana sehingga mundah untuk dipelajari, sangat cocok untuk pemula yang baru belajar dari nol.

Membuat Function FileExist:

Public Function FileExist(asPath as string) as Boolean ' fungsi
If UCase(Dir(asPath))=Ucase(trimPath(asPath)) then
FileExist=true
Else

FileExist=False
End If
End Function 'end of fungsi

Public Function TrimPath(ByVal asPath as string) as string 'fungsi

if Len(asPath)=0 then Exit Function
Dim x as integer
Do


x=Instr(asPath,"\")
if x=0 then Exit Do
asPath=Right(asPath,Len(asPath)-x)
Loop
TrimPath=asPath
End Function 'end of fungsi

Private sub command1_Click() 'command button
if fileExist(Text1.text) then
Label1="YES"
else
Label1="NO"
End if
End Sub 'end command button

Ilmu Visual Basic
("catatan : bukan isi sebenranya")

masuk kesini

Postingan populer dari blog ini

vb6 msflexgrid

Tutorial Visual Basic 6.0 : Listbox in VB6

Select Single Cell in MSHFlexgrid