Welcome Guest ( Log In | Register)



 
Reply to this topicStart new topic
> Learning Vb, Part 1 -- The Basics
Sizux
post Jan 17 2006, 10:36 PM
Post #1


Newbie [Level 2]
**

Group: Members
Posts: 29
Joined: 15-January 06
Member No.: 17,145



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.
Go to the top of the page
 
+Quote Post
Sarith Pallewela
post Jan 19 2006, 01:46 PM
Post #2


Newbie [Level 2]
**

Group: Members
Posts: 38
Joined: 13-January 06
Member No.: 17,042



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!!!
Go to the top of the page
 
+Quote Post
wassie
post Jan 19 2006, 09:45 PM
Post #3


-OLD ADMIN-
***********

Group: Members
Posts: 1,184
Joined: 20-June 04
From: the bath-tub...
Member No.: 50



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.
Go to the top of the page
 
+Quote Post
jumapao
post Jan 19 2006, 11:30 PM
Post #4


Newbie [Level 1]
*

Group: Members
Posts: 23
Joined: 30-December 05
Member No.: 16,396



ei can u teach me the "search" in vb and how to connect to a internet.. plssss....... thanks! mwah!! hehehehehehe!!!
Go to the top of the page
 
+Quote Post
amhso
post Jan 20 2006, 03:51 AM
Post #5


Super Member
*********

Group: Members
Posts: 425
Joined: 24-September 05
Member No.: 12,212



good tutorial. i recommend getting kudaz programming editor...although iono if it supports VB.
Go to the top of the page
 
+Quote Post
Dawiss
post Jan 20 2006, 05:26 PM
Post #6


Super Member
*********

Group: Members
Posts: 286
Joined: 4-December 05
From: Latvia, Riga
Member No.: 15,337



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..
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic

Collapse

> Similar Topics

Topics Topics
  1. Learning Vb(1)
  2. Your First Autoit(4)
  3. How To Play The Guitar And Basics For Any Instrument(0)
  4. Php Variable Basics(9)
  5. Css Basics(6)
  6. Want-to-start Html Tutorials(2)
  7. Learning Coldfusion Part 1(0)
  8. Css Basics No.2(0)


 



- Lo-Fi Version Time is now: 11th October 2008 - 02:47 AM