Trap17.com :   Mar 21, 2010
Open Discussion Forums > MODERATED AREA > Tutorials

Learning Vb - Part 1 -- The Basics

free web hosting
Open Discussion Forums > MODERATED AREA > Tutorials

Learning Vb - Part 1 -- The Basics

Sizux
NOTE: This guide assumes you know how to operate your compiler, meaning create objects and forms. This guild will only teach you the scripting.

Almost all program users and game players alike want to create their own software, whether it being a massive game, an easy-to-use calendar, or maybe even a hack. However, they must master, or at least know much about a programming language. If you've ever seen a Source Code , a text code written by a programmer and execute tasks by a computer, you'll know how much time and effort it takes to learn these nevertheless create them. This tutorial will demonstrate the basics of programming, which I feel VB is. VB, or Visual Basics, is a simple programming language created for inexperienced programmers to enter the world of programming. Once you've mastered Visual Basics, you can easily advance to harder languages like JavaScript and C++.

Before I get to the main subject, I'm going to mention a couple of important requirements. I recommend this language to you as long as you follow these:
  • You have an understanding of the language HTML. You should know a little bit of these before proceeding.
  • You have the patience to spend numerous hours devoting your time and effort into testing and maintaining scripts.
  • You know basic algebra.
  • You can study terms and uses for a long time and attach them into your mind for long periods of time.
  • You have nothing better to do. If you have a good life, don't spend your time with us nerds.

Now let us begin. Please note that I'm trying the best I can to simplify it in words and phrases you'll understand. If you don't understand something, don't panic. Most likely I will repeat it more clearly later on.

First off, you should get a nice program that runs and debugs Visual Basic script. I recommend Visual Basic 2005 Express Edition, which can be downloaded for free. Search for it to find it, since I don't want to post website links.

Now lets get to the good stuff--the programming. First off, every element has events. For example, the Enter your Post message form. When you enter your post and hit "Post New Topic/Post", the computer looks for code for that command. Cool, eh?

CODE
Dim CoolString as String


So, what does the above do? Well, "Dim" means to define. "CoolString" is the name of a variable. It can be anything you want. And "as String" means that the variable "CoolString" is a String. A string is simply a text. "CoolString" is a text that hasn't been defined yet. The Compiler, a program that runs scripts under certain programming languages, stores that variable inside its memory. You need to define what the variable is, which can be done later one.

CODE
Dim CoolInteger as Integer


The above code is similar to the first, except "CoolInteger" is defined as an Integer, which is a number. You can define what number "CoolInteger" is at anytime.

So, what’s the point of these? Well, suppose you wanted to add two values that can be changed. For example, the user types in "Hello" in one form, and "World" in the other. When he hits "OK", he wants the text to combine and say "Hello World". So, this is what he would do.

CODE
       Dim box1 As String
       Dim box2 As String

       box1 = TextBox1.Text
       box2 = TextBox2.Text

       MessageBox.Show(box1 + " " + box2)


Can you guess why this works? If not, I'll walk you through it.

First off, you call the variables "box1" and "box2" as string, which means they are both text. Then you tell "box1" that it's connected with "textbox1", which is the name of the first textbox. "box2" is connected with "textbox2", the second textbox. The "MessageBox.Show() command displays a message. The message is box1 (whatever the user typed in for textbox1, since they're connected) plus " ", which is just a space, plus box2 (whatever the user typed in for textbox2, since they're connected.) Easy, no? Well, the beginning stages are very confusing, so stay with me.

Now lets try Integers. We'll try making two forms that add numbers and display the results. Try it for yourself, and then compare it to mine.

CODE
       Dim box1 As Integer
       Dim box2 As Integer

       box1 = TextBox1.Text
       box2 = TextBox2.Text

       MessageBox.Show(box1 + box2)


As you can see, it's identical to the previous one, except the strings are now integers and I removed the space between the adding of box1 and box2.

So, now that you have this knowledge fresh in your mind, test around and try out the various types of coding. You can try the various Dim features and others you might find as well. I'm keeping the first tutorial nice and short to avoid losing my viewers attention. Once your done, check out my soon-to-come part 2 tutorial, which will discuss more features. Remember that the very beginning of your learning is hard; soon enough, though, it'll become easy.

 

 

 


Comment/Reply (w/o sign-up)

Sarith Pallewela
Nice Post on VB! It'll really help with the new VB programmer I REALLY MEAN IT! To told them every thing step by step BUT..

I am Telling this with UPMOST respect and THE NICEST WAY I CAN. biggrin.gif biggrin.gif biggrin.gif biggrin.gif
I my self am a vb programmer for 4 years an don't you think you should teach the lovely people how to like get the text of a text box ex. "MsgBOx("Welcome" & TExt1.Text) rather than teaching them string from the biggining?
I mean there are easier ways to get text or values from objects like Text boxes and Labels?

Other than that ht etotal post is really COOOOOL keep up the good work!!!

 

 

 


Comment/Reply (w/o sign-up)

wassie
very nice tutorial,
i tried to start on visual basic once... that was really horrible tongue.gif, to bad tho that now i'm more into the graphic programms.

Comment/Reply (w/o sign-up)

jumapao
ei can u teach me the "search" in vb and how to connect to a internet.. plssss....... thanks! mwah!! hehehehehehe!!!

Comment/Reply (w/o sign-up)

amhso
good tutorial. i recommend getting kudaz programming editor...although iono if it supports VB.

Comment/Reply (w/o sign-up)

Dawiss
emm.. I had once CB demo but my hard drive died and i lost it ;(... Can someone please tell me where to download it for FREE.. Nice tut if I had it I would try it our wink.gif..

Comment/Reply (w/o sign-up)



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

This textarea will convert to Rich-Text automatically (IE, Firefox, Chrome)

Similar Topics

Keywords : learning, vb, part, 1, basics

  1. Css Basics No.2
    More basics of css (0)
  2. Learning Coldfusion Part 1
    LEARN CF... GRADUALLY INCREASE YOUR KNOWLEDGE OF COLDFUSION (0)
    Hello, I havent really seen to many coldfusion tutorials around. I also looked for some on here
    which I couldnt find any... (Must have over looked if I did'nt see it). Anyways we are going
    to be learning the basics of ColdFusion and from now on I may refer to it as CF so please do not get
    confused. CF is a very powerfull scripting language, it is a easy transistion if you know PHP, and
    is also easy to learn if you do not. In CF you have diffrent operators styles and IF formats.
    Example: PHP Operators in a IF statement if( var1 == var2 ){ // What Happens H....
  3. Want-to-start Html Tutorials
    An HTML tutorial that covers the basics (2)
    NOTE: Don't use a rich text editor* for writing HTML code! Use Notepad in Windows,
    SimpleText in Mac or TextEdit in OSX, but you must set the following preferences for the HTML code
    to work! In the Format menu, select Plain Text. Open the preferences window from the Text Edit
    menu, then select "Ignore rich text commands in HTML files." Start Creating Your Own HTML File
    You can either use HTM or HTML file extensions. For more information, visit:
    http://filext.com/file-extension/htm for HTM or http://filext.com/file-extension/html for HTML.
    Ope....
  4. Css Basics
    Just for those who know nothing about css yet. (6)
    A tutorial on some of the basics of css.... I wrote if for my site, may as well post it here too
    /tongue.gif" style="vertical-align:middle" emoid=":P" border="0" alt="tongue.gif" /> CSS Basics
    Description For those of you that don't know, CSS stands for Cascading Style Sheets. The whole
    point of it is to easily edit all of the pages on your website, so you don't have to edit each
    on individually. In this tutorial, you will learn some of the basics. Try It Out Css Syntax has
    three parts to it. The object (where you want to edit), the property (what part ....
  5. Php Variable Basics
    Where would PHP programmers be without the variable? Learn all about t (9)
    CODE $var= "This is a variable"; echo $var; ?> Outcome This is a variable Using what we
    know about the echo function, we can see that we have created a variable, and then used the echo
    command to display it. This is fairly simple, and can have many uses, but there is much more too it!
    CODE $var1 = "This is variable one"; $var2 = "This is variable two"; $varall = "$var1. $var2.
    You just combined three variables in one!"; echo $varall; ?> Outcome This is variable one. This is
    variable two. You just combined three variables in one!"; So what? We may as wel....
  6. How To Play The Guitar And Basics For Any Instrument
    introductory musical instruction focused on the guitar (0)
    So, you've had your guitar for years and it just sits around collecting dust. But you don't
    have the money to get lessons and you don't think you can play anyway. Well, most likely you
    can play, all you need is practice and little tolerance for pain in the first two weeks. Pain? Why
    pain? Pain because you must condition your fair fingertips for the constant bombardment of pressure
    from metal strings. (Nylon strings are a bit easier and I like them, but it is best to practice on
    the worst strings possible...accoustic, high action and thick gauge so that ....
  7. Your First Autoit
    Learning To Code.. (7)
    Autoit is a simple, yet powerful programming language, it allowed the creation of the pangea
    desktops, and the Remote Pc Control with a cell.. You can learn it too. Here is the first of several
    lessons i will post inside of this topic. It is a 32 bit program, it doesnt work on windows 98, 95,
    and i dont think (THINK) Windows ME Step 1: Download and install the latest version of autoit from
    http://www.autoitscript.com i prefer that you use beta. Step 2: Right click somewhere on your
    desktop or my documents, and mouseover new and click Autoit V3 Script Step 3 (optiona....
  8. Learning Vb
    Part 2 -- Various Techniques (1)
    Notice: Coding between compilers may vary. For example, "messagebox.show()" is the message prompt in
    Express Edition whereas "msgbox()" is the prompt in Visual Basic 6.0. All code in this guide is
    Express Edition. In part on, we learned the basics of Visual Basic, including Strings and Integers.
    Once you feel comfortable with it, you can move onto this part. As said before, the beginning part
    of learning is the hardest. Since this is still the beginning, you may struggle on some things.
    Don't worry though; things are repeated numerous times. First off, we are going....
  9. Php - The Basics
    Learn the basics of PHP (44)
    I should point out that I originally put this tutorial together for another site, but decided
    against it and to place it here instead (because I love you guys... ~sniffle, wipe a tear away~).
    This tutorial should help get you started if you are just setting out into the big bad world of eb
    development. I have been coding in PHP for a little over a year now, and have worked on several
    large projects in the language - but whilst I certainly don't know everything about it, I would
    like to share some of the basics that hopefully will give you a bit of a kick start. ---....
  10. Assembly Tutorial Part I
    The basics through "Hello world" (4)
    Okay, because assembly is an awesome language that is being viewed as archaic in the face of high
    level languages, I'm writing this series of tutorials. Note: This tutorial assumes a working
    knowledge of binary and hex. If you don't have a working knowledge of these number systems, and
    you are interested in learning assembler, let me know and I'll write a brief introduction to
    binary. Currently, until I can do some testing, this tutorial also only works for Windows and
    MS-DOS computers. If anyone with a Linux box is willing to test a routine for me, pleas....

    1. Looking for learning, vb, part, 1, basics



Searching Video's for learning, vb, part, 1, basics
See Also,
advertisement



Learning Vb - Part 1 -- The Basics

Affordable Web Hosting, Low cost Web Hosting - ComputingHost.com



Creative Commons License