|
-
Oct 29th, 2009, 10:34 AM
#1
Thread Starter
Fanatic Member
[RESOLVED] Check for a file in app directory
Hi guys,
Does anyone know how to make it so when a user presses a command button it checks to see if there is a file for example "file.exe" in the same folder as the application and if the file is in their (file.exe) then it will load form 2. But if the file aint fount it gives them a msgbox "File.exe was not found please download file.exe before continuing"
thanks
-
Oct 29th, 2009, 10:41 AM
#2
Re: Check for a file in app directory
Here is an example. Modify it to suit your individual needs
vb Code:
If Dir$("c:\autoexec.bat") <> vbNullString Then
MsgBox "file exists"
Else
MsgBox "file doesn't exist"
End If
End Sub
-
Oct 29th, 2009, 10:45 AM
#3
Re: Check for a file in app directory
vb Code:
Sub Sample() Dim FlName As String '~~> Replace with Relevant File name FlName = Dir(App.Path & "MyFile.Exe") If (FlName) <> "" Then '~~> File is there Form2.Load Else '~~> File is not there MsgBox "File Doesn't Exist" End If End Sub
Edit: Ah! Hack beat me to it...
A good exercise for the Heart is to bend down and help another up...
Please Mark your Thread " Resolved", if the query is solved
MyGear:
★ CPU ★ Ryzen 5 5800X
★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
★ Keyboard ★ TVS Electronics Gold Keyboard
★ Mouse ★ Logitech G502 Hero
-
Oct 29th, 2009, 10:51 AM
#4
Thread Starter
Fanatic Member
Re: Check for a file in app directory
Awesome!!
Thanks guys, Really appreciate it!
All the best,
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
|