Results 1 to 2 of 2

Thread: Visual Basic .:. Basics Tutorial Lesson

  1. #1
    Join Date
    May 2005
    Posts
    67

    Default Visual Basic .:. Basics Tutorial Lesson

    To start off, lets make sure you have everything in this checklist:
    -Microsoft Visual Basic 6.0
    -Time
    -Patience
    -You MUST be willing to devote time to Visual basic, or else you will never get better.
    If you do not have all these things, then please, dont finish reading and waste your time.
    ----------------------------------

    Now lets understand a few things..

    Code:
    Variables- letters that represent a integer or text, or both.
    Integer- Can contain any number from  -32,768 to 32,767 
    String-Contains any line of text or a combination of text and numbers
    Boolean-I really didnt understand these at first, but all it is, is a fancy word for true/false
    Double- -1.79769313486232E308 to
    -4.94065645841247E-324 for negative values; 4.94065645841247E-324 to 1.79769313486232E308 for positive values 
    Single--3.402823E38 to -1.401298E-45 for negative values; 1.401298E-45 to 3.402823E38 for positive values 
    Long- A number from -2,147,483,648 to 2,147,483,647 
    Variant- Really slow datatype, will use any datatype that fits what you are storing in variable
    Now you dont have to really understand all that, but its good to reference to for errors.
    --------------------------

    Now, to start off, run Microsoft Visual Basic 6.0 (well refer to it as VB from now on). After it opens it will contain a box that pops up, click the first item, "Standard EXE".
    We are going to make our first program!

    On the left side of your screen, you will see a button that when you hover your mouse over it, it will say "CommandButton". Click it, and add it to your form, the form is the dotted looking thing in the middle of your screen. Now we have a button on our form.
    -
    Now we want to add a textbox, add it anywhere on your form(its on the left side of your screen directly above the commandbutton, it says "ab|".
    -
    Now to add the code, to make this baby run! double click anywhere on a form. It will load a new window, lets call it the coding window. At the very top, type:dim add as integer

    Now, what we have done, is declared the word "add" as an integer, or a regular number.
    -
    Now, close this little white window where you typed dim add as integer, and double click the commmand button, inside the private sub.. and end sub type:
    add = add + 1
    text1.text = add
    -
    What we are doing, is making it so that add(the integer) = itself plus one each time, thus increasing its value. Then we are placing it in text1.text so you can actually see the value.
    -
    Now, you should also see:
    private sub form_load()

    end sub

    somewhere in your coding window, if you dont see it, then double click on your form and it will popup. Inside type add = 0.

    What we are doing is setting Adds value to zero, so that it can be added. If we didnt, then it would give us errors because we cant add to something we dont have!
    -

    Now your code should look like this, not neccessarily in the same order though.

    Code:
    Dim add as integer
    
    Private sub Form_load()
    add = 0
    end sub
    
    Private sub command1_click()
    add=add + 1
    text1.text = add
    end sub
    Now on the top of your screen, press the little play button and test it out!!

    You made your first program mate!!

    Lesson 1, we are done for today :D

  2. #2
    Join Date
    May 2005
    Location
    Tamil nadu
    Posts
    187

    Default

    COPIED TO NOTEPAD WILL PERFORME AND REPLY SOON..THANKS FOR THE TIP..

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •