Jul 7, 2008

Learning Vb - Part 2 -- Various Techniques

Free Web Hosting, No Ads > CONTRIBUTE > Tutorials

free web hosting

Learning Vb - Part 2 -- Various Techniques

Sizux
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 to learn how do use an Input Box, a box where you can enter text and record it. To do that, we need to use another Dim. For this particular case, we need to use the Dim Object command. Dim Object, when declared, tells the compiler to store an object into the memory. Objects can be many types of forms or message boxes--in this case, an input box.

CODE
Dim box as Object


The variable "box" is now an object. So we need to tell the compiler what object it is. We want Mr. box to be an input box, so let's say so.

CODE
box = InputBox("What is your name?")


The "box = InputBox" defines it. The ("") is simply text. You can add variables in there by simply removing the quotes. When you run this, you'll see something like this:

user posted image

This is nice, but it doesn't do anything when you click OK. We're going to add a textbox afterwards saying what the user typed in the box. How do we do that? Simple.

CODE
       Dim box As Object

       box = InputBox("What is your name?")

       MessageBox.Show("Your name is " + box)


When the data is entered, it is stored in the variable "box". Objects, such as "box", can store both alphabetical (strings) and numerical (integers) characters. After the user has entered a value, the message "Your name is " will show up. Then, the value "box" (AKA: The value the user entered" will show up, following the space at the end of the message "Your name is ". Easy? Try understanding this one:

CODE
Dim name As Object
       Dim age As Object
       Dim state As Object
       Dim city As Object

       name = InputBox("What is your name?")
       age = InputBox("What is your age?")
       state = InputBox("What state do you live in?")
       city = InputBox("What city do you live in?")

       MessageBox.Show("Your name is " + name + ", you're " + age + " years old, and you live in " + city + ", " + state)


When you want to compare certain information, you use Signs, symbols that represent greater then, less then, and equal. Actually, there is more then that. This table shows the signs and their meaning.

CODE

>                                  Greater Then
<                                  Less Then
=                                  Equals
<>                                Not equal
<=                                Less then or equal to
>=                                Greater then or equal to


Tip: If you confuse greater and less then signs, think of their looks. The < sign looks like an "L" if you turn it, which means "Less then".

We are also going to learn Branching, coding comparing multiple data and varying on their conditions. Branching must always start with "If" and end with "End If" There must also be an "Else" condition in the middle. Most compilers, however, already add the "End If" and "Else".

CODE
       If 5 = 5 Then
           MessageBox.Show("This code is correct!")
       Else
           MessageBox.Show("What happened here?")
       End If


Branching is like asking a question. This case, it is saying "Is the number 5 equal to the number 5?" Of course, this is true. So, the value under "If 5 = 5 Then" is what happens when this is true. The value under "Else" is what happens when it's incorrect. So, what'll show up here? Easy.

Read through the following code and think to yourself what it does.

CODE
       Dim check As Object

       check = InputBox("You must be 10 years or older to access")

       If check >= 10 Then
           MessageBox.Show("OK, you're old enough")
       Else
           MessageBox.Show("In a few more years, sonny")
       End If


This code is simple. If you enter a number equal to 10 or higher, the message "OK, you're old enough" will appear. However, if you say the number 9 or below (negatives count), then the other message will appear.

Let's now learn comments. These helper’s help--and a lot. Comments are side-notes added into the script that do nothing but tell you a note. They are NOT displayed in the program itself. Here is how you do a comment:

CODE
' This is a comment!


Everything displayed on the line following the ' is a comment. You can use them to remind you of things. Pretty easy.

I'm coming to a conclusion on this tutorial. But I'll bring you one nice tip; check over your work. You can make pretty stupid mistakes that you miss. Some compilers will find them for you, but be cautious.

CODE
Dim apple as delicious


If you have any questions, just post them. I'll try to answer as many as I can. Please remember that I'm not an expert at this; so don't ask me to build an operating system.

 

 

 


Reply

final_fantasy
gooooooog!

Reply



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*

(Maximum characters: 10,000)
You have characters left.
Confirm Code:

Similar Topics

Keywords : learning, vb, part, 2, techniques

  1. Getting Rid Of That Little Pot Belly
    Or anyother little flabby part of your body :) (0)
  2. Learning Php
    (3)
    hey People ... i m really interested in Learning PHP Programming .. so plzz cud u suggest me from
    wher should i learn PHP .. There r no Institutes that teach PHP in India ! .. So could u all
    suggest me some real good stuff from wher i cud learn PHP .. As u trapsters r good in PHP ..
    !! .. Thnxzzz `` ! ....
  3. Link Between Depression And Learning Disabilities?
    Can depression cause learning disabilities? Do learning disabilities (3)
    I have been diagnosed with clinical depression. I have found at times that it is hard to
    concentrate (more often than not). I also have a hard time remembering things. I know that these
    are typical symptoms of depression but am wondering if depression itself can be considered a
    learning disability due to it's symptoms and side effects. I have done a little of research on
    the subject and see many references to people with learning disabilities developing depression
    because of having learning disabilities. Does anyone know of a good article, or maybe a website
    with....
  4. Bill Bailey's Part Troll... What Is That Thing?
    (0)
    I was watching the Bill Bailey Part Troll DVD, and was wondering what that thing is on the left that
    he has on the (our) left that he waves and it works as a kind of synthesizer. I Really don't
    know what it is, and would like to. For those of you who don't know what I'm talking about
    here is a youtube link http://au.youtube.com/watch?v=TqDl491ORqM It's the thing on the left
    that he waves his hand near and it 'squeaks'. I first thought there was strings or
    something in the loop at the front he was playing, but that seemed to be wrong, as it m....
  5. Download A Free Copy Of The Photoshop Anthology: 101 Web Design Tips, Tricks & Techniques
    (4)
    I just got an email today and sitepoint.com is giving another one of their books away for free. All
    you do is give your email and a short while later you will get a download to your free copy of this
    photoshop book. This deal lasts for 30 days so get your copy NOW!!
    http://photoshop.aws.sitepoint.com/ ....
  6. Css- Review With Tutorial
    If u r learning CSS, learn it with me. (2)
    Are u still using html ? My friends, Html is not very effective tool for website page making. Iam
    webdeveloper. When I was new, I spend the whole day in website adjusting layouts, putting table tags
    and blank spacer images and large text images with exact font sizes. When a client suddenly changed
    his decision on the layout I change lot of webpages. It was really painful. If you decide to modify
    design layout of your pages there will also editing and reediting . Now I say bye-bye to html
    because iam using cascading style sheets (CSS). CSS is solution of all above pr....
  7. Best Sites For Learning Php-mysql
    (4)
    Hi I was reminded of this earlier by a post in a topic, meant to post it but forgot and the topic on
    php books reminded me. Well anyway there is tyhschools for learning php (unless someone else knows
    a better 1) but I wan't to know what is the best site for using php with mysql (using
    phpmyadmin) also whats the difference between postgresql and mysql? though I must admit the
    postgresql version of phpmyadmin whatever it's called looks better (visually)!....
  8. What Are The Best Books For Learning Php
    Please suggest a book (5)
    I would love some recommendations on what books are most helpful for learning PHP. I know XHTML,
    CSS, some Javascript. I do know some PHP as well. Also can someone also recommend some books on
    Advanced PHP, that actually shows how to create a fully functional and somewhat complex
    website/application. (Like RailSpace does for Ruby on Rails)....
  9. Learning Chinese?
    Would learning chinese benefit my career? (5)
    Hi, I am asking this question because I would like to hear some of your opinions regarding learning
    chinese as a benefit in my career. I have been thinking about it ever since I learned that the
    company called foxconn is going to open a facility here in my city, and the so called "headhunters"
    are searching for people who speak english and chinese. This is going to happen a couple of months
    from now and there is no way I can benefit from this opportunity yet as I dont think I will be able
    to speak chinese a couple of months from now.... The thing is that I speak spanish....
  10. Java Part 1
    (2)
    The HTML <script> tag is used to insert a JavaScript into an HTML page. Examples Write text
    with Javascript - http://www.w3schools.com/js/tryit.asp?filename=tryjs_text The example
    demonstrates how to use JavaScript to write text on a web page. Write HTML with Javascript -
    http://www.w3schools.com/js/tryit.asp?file...ryjs_formattext The example demonstrates how to use
    JavaScript to write HTML tags on a web page. How to Put a JavaScript Into an HTML Page CODE
    <html> <body> [color=red]<script type="text/javascript"....
  11. Seo And Php, Do You Really Need Programing Skills?
    Do you think learning PHP is a must in order to start doing SEO?? (5)
    Any advice on what technical skills are needed to start doing SEO?....
  12. Do You Believe In Astrology?
    The Personality part or The Futeure (19)
    One day, I received a Phone call from the editor in chief of the magazine I write for asking me to
    write the astrology section because the section's writer was sick. I didn't care alot for
    astrology before, but for me to write this section, I had to study what astrology is.. As I read
    more.. and dive deeper inside that strange space, as I see Aries fighting with Aries and The
    Scorpion in love with The Cancer, I start to believe more and more in that astrology thing.
    Astrology really reflects the personality things, giving a blurry but kind of truth full one.. so....
  13. 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....
  14. Writing An Essay - Part I: Sentences
    Fragments and Run-ons (6)
    Writing essays is NOT a talent; it's a skill. As a skill, it can be honed and improved, like
    playing basketball, carving wood, or cooking. True, there are those who just do it better, as in the
    other areas mentioned, but that doesn't mean that you can't be good at it with a little
    know-how and practice. As an English teacher, it's my job to show students how to do that, so I
    figured that I would give everyone a few tips on how to improve your writing and, someday, make my
    job a little easier. The first basic building block of a good essay is to have well....
  15. Make A Song In Fruity Loops Final Part
    final part in the tutorial covering (filling out the song to be better (2)
    ok so this being the final part in this tutorial i would like to say that i give permission to remix
    the content gatherd over the course of this tutorial as it is the sole propperty of myself in and of
    that i created it. you have the permisson to, remix the origeonal content publis your remix aslong
    as you name it as (dj starskream.song title,remix by,your name,) publicly play and earn from it as
    a title produced by dj starskream but remixd by yourselfs. now if at anny time the above rules of
    remix are not followd provideing that you intend to release as a remix by yo....
  16. Making A Song In Fruity Loops Part Three
    part three precusion (0)
    ok part three now which covers the precusions setup of the small song i built for this tutorial.
    the nesecery files can be downloaded here the image below is included in the precusions folder as
    it mught not be entierly visable within this post so shold you need it its there also the images
    purpose is to enable you to see what i am refering to within this tutorial lateron. now what i
    have done above is blackd out every pattern that has nothing to do with the precusion. so the
    patterns displayed in light grey are the only patterns i will be refering to. ok lets b....
  17. Making A Song In Fruity Loops Part 2
    part 2 the second melody (0)
    ok i am going to attach the midi file againe incase you didnt get it from the first part in this
    part i will demonstright how to create and insert the second mellody ok so you have your first
    mellody wich is ecetially the comein chord as i call it. now open the midi file you put in your left
    panel during the first tutorial and drag the mellody 2 © onto the pallet but click on pattern two
    in the right site playlist box. now like in the first tutorial replace with sytrus. for this type
    of mellody use something in the leads section of the plugin.for this you need to ....
  18. Anyone Want To Be A Part Biz Owner?
    (14)
    I am look for someone who wants to be a 1/3 owner of unreal computers I will NOT pay you. But please
    consider it. I need help setting up the biz so I can sell my stuff but I really need someone who can
    program PHP... Please post here or email me at masta.hacks@gmail.com....
  19. Learning To Cook Moroccan Food
    Coming from America to Morocco (1)
    Moroccan food is different then typical american food. I am trying to learn how to make cousous.
    There is an istant mix that can be bought at Walmart. Couscous can be made is 15 minutes just add
    water and your done. Next add vegetables and meat and the meal is ready to eat. The taste is not
    the same as found in Morocco. I dont know if cousous can be made in the states as it is in Morocco,
    I cant find it. I can only find the instant packages.....
  20. Pbs Video On Learning Disabilities
    (2)
    I am currently in the process of attaining my teaching credential in California, so I'm taking a
    course on Teaching Strategies. Last night we watched a video that really opened our eyes to the
    difficulties that Learning Disabled students face. Though "How Difficult Can This Be: The F.A.T.
    City Workshop" is obviously dated, gotta love those enormous 80s shoulder pads, the ideas and
    methods that Rick Lavoie demonstrated still pertain today and are, unfortunately, not implemented as
    widely or as thoroughly as they should be. The F stands for frustration, A for anxiety,....
  21. Runescape 2 Private Server Guide: Part 2
    No-ip setup (19)
    Overview: In part 2 i will describe how to set up no-ip. no-ip is a simple way of hosting a
    private server and it is most commonly used. if this does not work, there is another way i will tell
    about in part 3. part 2 and 3 are short, yet effective guides that are aimed at helping you! If
    you are not sure if it is working, it is probably because you have not read part 4: Port Forwarding
    Chapters: Chapter 1: What is No-ip? Chapter 2: Initial Setup Chapter 2 Section A:
    Creating an account Chapter 2 Section B: The DUC Chapter 3: Config Chapter....
  22. Runescape 2 Private Server Guide: Part 1
    making a private server (15)
    According to RuneScape TOS, as long as your private server does not connect/interfere with the
    actual server this 3rd party software is not breaking the real RuneScape TOS. Please use this
    information accordingly. If any RuneScape representative feels that this post is against your TOS,
    please contact Trap17 admins via PM or email. Thank you. This is part 1, focused on making a
    private server and such, if you would like, i will post more on customization in other parts.
    Overview: This guide will explain the basics for building your very own rs private server&....
  23. Ftp Account Management
    Part 2.2 of my 7 Part Cpanel Tutorial (1)
    This tutorial is an extension to my 7 tutorial series about the Cpanel. The 7 different Cpanel
    tutorials can be found below. Part 1: E-mail Management Part 2: Useful Site Management Tools
    Part 3: Useful Site Management Tools2.1 Part 4: Analysis/Log Files Part 5: Advanced Tools Part
    6: PreInstalled Scripts, Extras, and Cpanel Options Part 7: Fantastico Detailed Cpanel
    Tutorial Part 2.2: FTP Management For this tutorial, you will need to locate the Icon under
    Site Management Tools labeled FTP Manager and also inside of the FTP:// Accounts area....
  24. Cpanel Preinstalled Scripts, Extras, And Cpanel Options
    Part 6 of My 7 Part Tutorial (1)
    This Tutorial will be divided into 7 different parts, and this is the first part, when i get the
    other parts together, i will post the links under here /biggrin.gif" style="vertical-align:middle"
    emoid=":D" border="0" alt="biggrin.gif" /> Enjoy. Part 1: E-mail Management Part 2: Useful Site
    Management Tools Part 3: Useful Site Management Tools2.1 Part 4: Analysis/Log Files Part 5:
    Advanced Tools Part 7: Fantastico Detailed Cpanel Tutorial Part 4: PreInstalled Scripts,
    Extra, and Cpanel Options In this tutorial I will, in detail explain all of th....
  25. Help Me In Learning Ms Dos !
    (11)
    Hi buddies here is a topic where I want help from you. Infact , buddies I am using computer for
    allmost last 3 years . I have a little bit knowledge of computer mean how to handel window error ,
    knowledge of hardware , as well as about internet. The only thing where I want to learn some thing
    is MS DOS . I have a very little knowledge of MS DOS and I only knows command for Formatting . I
    wana to learn allmost the basics of MS DOS. Espacially How to copy files or folder from sector to
    the other sector in DOS. How to delete files and folders in DOS. How to rename files and....
  26. Detailed C Beginner Tut
    basis for learning any application programming language (2)
    QUOTE The best way to learn programming is to dive right in and start writing real programs.
    This way, concepts which would otherwise seem abstract make sense, and the positive feedback you get
    from getting even a small program to work gives you a great incentive to improve it or write the
    next one. Diving in with ``real'' programs right away has another advantage, if
    only pragmatic: if you're using a conventional compiler, you can't run a fragment of a
    program and see what it does; nothing will run until you have a complete (if tiny or trivi....
  27. Are You Part Of The 2% Or The 98%?
    mind guessing game (18)
    2% or 98% of Population?Just follow these instructions, and answer the questions one at a time and
    as quickly as you can! Again, as quickly as you can but don't advance until you've done
    each of them .... really. Now, scroll down (but not too fast, you might miss something). THINK of
    a number from 1 to 10 MULTIPLY that number by 9 If the number is a 2-digit number, ADD the
    digits together Now SUBTRACT 5 DETERMINE which letter in the alphabet corresponds to the
    number you ended up with (example: 1=a, 2=b, 3=c,etc.) THINK of a country that....
  28. Microsoft Publisher
    A part of Microsoft Office 2003 (7)
    Hello all, I just got my hands on the Microsoft Publisher, which comes with the Microsoft Office
    2003. I feel this is the best website designing tool ... much better than Dreamwevar and the likes.
    I had finished making my site in under 10mins. Also the menu options, to put on your site are very
    good n advance. The best part is that it not only lets you create fully customizable sites without
    knowing absolutely anything about HTML, it also allows you to do other publishing tasks like making
    greetings, stationary, visting cards etc. This is not an advert, but i think ....
  29. Your Winning Eleven
    Who will be part of your soccer dream team? (6)
    I'd Like an International Outfit mostly with German players. I prefer a fighting team rather
    than one that is star-studded. FORMATION: 4-1-2-1-2 Goal Keeper - TIMO HILDEBRAND, Vfb Stuttgart
    Very Consistent player. Should be Germany No. 1 by now. OLi isn't as fast he used to be. Jens
    is mediocre if you ask me. Left Back - PHILLIP LAHM, Vfb Stuttgart Attacking minded, pacey Winger.
    Center Back - JOHN TERRY, Chelsea Good positional Sense, good in the air and in set pieces.
    Center Back - JENS NOWOTNY, Bayer 04 Leverkusen Top Rated European Defender, Can t....
  30. Learning Mysql
    pls guide (3)
    hello out there, i have already looked through on this tutorial forum.. and still can find any
    topics which related to MySql basic.. i wanna learn about how to create MySql table and its
    concept!! just basic.. i've no knowledge on MySql before nor any other database server
    software.. but i do have littol konwledge on programming,scripting,html basic in concept.. pls dun
    gave me so many links so as i can be blur for none about how to get start!! /laugh.gif'
    border='0' style='vertical-align:middle' alt='laugh.gif' /> i can thou find from Googles sear....

    1. Looking for learning, vb, part, 2, techniques

Searching Video's for learning, vb, part, 2, techniques
Similar
Getting Rid
Of That
Little Pot
Belly - Or
anyother
little
flabby part
of your body
:)
Learning Php
Link Between
Depression
And Learning
Disabilities
? - Can
depression
cause
learning
disabilities
? Do
learning
disabilities
Bill
Bailey's
Part
Troll...
What Is That
Thing?
Download A
Free Copy Of
The
Photoshop
Anthology:
101 Web
Design Tips,
Tricks &
Techniques
Css- Review
With
Tutorial -
If u r
learning
CSS, learn
it with me.
Best Sites
For Learning
Php-mysql
What Are The
Best Books
For Learning
Php - Please
suggest a
book
Learning
Chinese? -
Would
learning
chinese
benefit my
career?
Java Part 1
Seo And Php,
Do You
Really Need
Programing
Skills? - Do
you think
learning PHP
is a must in
order to
start doing
SEO??
Do You
Believe In
Astrology? -
The
Personality
part or The
Futeure
Learning
Coldfusion
Part 1 -
LEARN CF...
GRADUALLY
INCREASE
YOUR
KNOWLEDGE OF
COLDFUSION
Writing An
Essay - Part
I: Sentences
- Fragments
and Run-ons
Make A Song
In Fruity
Loops Final
Part - final
part in the
tutorial
covering
(filling out
the song to
be better
Making A
Song In
Fruity Loops
Part Three -
part three
precusion
Making A
Song In
Fruity Loops
Part 2 -
part 2 the
second
melody
Anyone Want
To Be A Part
Biz Owner?
Learning To
Cook
Moroccan
Food -
Coming from
America to
Morocco
Pbs Video On
Learning
Disabilities
Runescape 2
Private
Server
Guide: Part
2 - No-ip
setup
Runescape 2
Private
Server
Guide: Part
1 - making a
private
server
Ftp Account
Management -
Part 2.2 of
my 7 Part
Cpanel
Tutorial
Cpanel
Preinstalled
Scripts,
Extras, And
Cpanel
Options -
Part 6 of My
7 Part
Tutorial
Help Me In
Learning Ms
Dos !
Detailed C
Beginner Tut
- basis for
learning any
application
programming
language
Are You Part
Of The 2% Or
The 98%? -
mind
guessing
game
Microsoft
Publisher -
A part of
Microsoft
Office 2003
Your Winning
Eleven - Who
will be part
of your
soccer dream
team?
Learning
Mysql - pls
guide
advertisement



Learning Vb - Part 2 -- Various Techniques



 

 

 

 

ADD REPLY / Got an Opinion! Remove these ADs! RAPID SEARCH! Free Web Hosting [X]
Express your Opinions, Thoughts or Contribute more info. to help others.
Ask your Doubts & Queries to get answers, So that "Together We can help others!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE