Browse DevX
Sign up for e-mail newsletters from DevX

Tip of the Day
Language: Visual Basic
Expertise: Beginner
Aug 4, 1997



Building the Right Environment to Support AI, Machine Learning and Deep Learning

"File Exists?" Revision

To adapt the tip "File Exists?" (see "101 Hot Tech Tips for VB Developers," Supplement to the August 1996 issue of VBPJ, page 7) to a directory list box, it is necessary to control the error that occurs when the user selects the root (C:\):
Sub Dir1_Change
	Dim File As String
	File = Dir1.Path
	If Right$(File, 1) = "\" Then
		File = File & "himem.sys"
		File = File & "\" & "himem.sys"
	End If
	' Chuong Van Huynh's tip 
	If Dir$(File) <> "" Then
		MsgBox "himem.sys exists !"
	End If
End Sub
Without testing to see if the path already ends with a backslash, as it would when it's the root directory, an error occurs because of the string "c:\\himem.sys."
Michel Rohan
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date