Make web browser accept only file paths?

You could let them use the OpenFileDialog to browse to existing file, then Navigate to that path.
 
check the passed string from textbox. If it contains anything like .com, .net, .org etc. give a message saying "Invalid File"
 
you could use textbox1.text.contains() method.

if(textbox1.text.contains(".com") or textbox1.text.contains(".org") then
msgbox("invalid file")
end if

the only problem can be if the document has .com or .org in it.
 
You can validate that the file exists: File.Exists Method (System.IO)
Remember to provide a OpenFileDialog also for people that don't want to type or copy/paste the file path.
 
Back
Top