useful code

Discussion in 'Programming General' started by TheDevelpoer, Nov 11, 2009.

useful code
  1. Unread #1 - Nov 11, 2009 at 5:10 PM
  2. TheDevelpoer
    Joined:
    Nov 11, 2009
    Posts:
    3
    Referrals:
    0
    Sythe Gold:
    0

    TheDevelpoer Newcomer

    useful code

    My simple but useful code bank



    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
    You get no errors and it will check for the file now lets say you need to create a file:

    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

    1. Save your project in a folder.(make sure you can remeber where it is for later on.)
    2. go to the build tab and press build.
    3. go to that folder sinside should be bin.
    4. inside bin there should be a folder called release look in there if empty go to debug.
    5. There should be a file named [yourprojectname] and the type shoudl be application drag onto desktop.(only the exe!)
    6. run if error free rename and upload or email to your pals.
     
< Any GUI Programs? | homework help plss >

Users viewing this thread
1 guest


 
 
Adblock breaks this site