TheDevelpoer
Newcomer
- Joined
- Nov 11, 2009
- Sythe Gold
- 0
- Messages
- 3
My simple but useful code bank
In Visual Basic 6 app.path is used here is the Visual Basic 2008 code:
Checking for file existence.
Now those are both going to give you errors but if we mix them and use:
You get no errors and it will check for the file now lets say you need to create a file:
Now lets say you want to find out if a folder exist:
Now what if you want to create a folder:
Now at the moment this code will again give you errors.
so id you put the too together you can get:
How to Make your files .EXE
In Visual Basic 6 app.path is used here is the Visual Basic 2008 code:
Code:
Application.StartupPath()
Checking for file existence.
Code:
System.IO.File.Exists()
Now those are both going to give you errors but if we mix them and use:
Code:
If System.IO.File.Exists(Application.StartupPath() & "\file.extension then
Code:
System.IO.File.Create(Application.StartupPath() & "\file.extension")
Now lets say you want to find out if a folder exist:
Code:
System.IO.Directory.Exists()
Now what if you want to create a folder:
Code:
System.IO.Directory.CreateDirectory()
Now at the moment this code will again give you errors.
so id you put the too together you can get:
Code:
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
If Not System.IO.Directory.Exists(Application.StartupPath() & "\test") Then
System.IO.Directory.CreateDirectory(Application.StartupPath() & "\test")
End If
End Sub
End Class
How to Make your files .EXE
- Save your project in a folder.(make sure you can remeber where it is for later on.)
- go to the build tab and press build.
- go to that folder sinside should be bin.
- inside bin there should be a folder called release look in there if empty go to debug.
- There should be a file named [yourprojectname] and the type shoudl be application drag onto desktop.(only the exe!)
- run if error free rename and upload or email to your pals.

