Jump to content
xisto Community
Sign in to follow this  
Sizux

Learning Vb Part 1 -- The Basics

Recommended Posts

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?

 

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.

 

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, whats 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.

 

       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.

 

       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.

Share this post


Link to post
Share on other sites

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. :D:D:(:( 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!!!

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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 :(..

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.