3/30/12

Using if statements in visual basic 2010


Today I will be showing you how to use the all famous if statements in visual basic 2010, They are fairly easy to use. if statements allow you to create more complex functions for your program so in this tutorial we will be saying that if a textbox says a certain thing then a certain thing will happen. First of all open up visual basic like so.


Now create a new project you should know how to do this if not see the first tutorial on visual basic. Name the new project "if statement tutorial" Now in the new project you will need to put a textbox and two buttons on the form like this.
So as you can see you will need to place the textbox in the centre of the form and the two buttons in the bottom corners of the form. Name the far left button "HELLO" and the far right button "BYE". Now we have the form set up all you need to do now is double click the back form to get the coding screen up. And on the coding screen you will need to type this code in.

There are four if statements used in this application and these are the four bottom codes of the coding lines. The first if statement means that if the textbox we put in earlier says "HELLO" then button1 which is the one that says "HELLO" becomes visible. The second if statement means exactly the same but with button2 which says "BYE" and the textbox has to say BYE. 


This is a short one but its a simple thing to understand stay tuned for more great visual basic tutorials

SHARE THIS POST:

Related Posts:

  • Creating and using String Variables in visual basic In today's tutorial I am going to be showing you how to declare and use string variables in visual basic 2010. The very basics of what you need to know about string variables are it will store a string of characters with … Read More
  • Using if statements in visual basic 2010 Today I will be showing you how to use the all famous if statements in visual basic 2010, They are fairly easy to use. if statements allow you to create more complex functions for your program so in this tutorial we wil… Read More
  • An introduction to using Visual Basic 2010 Visual basic is an IDE that allows you to make a GUI and then make it do what you want writing code in a language called visual basic. Visual Basic has many useful tools such as the ability to add components from… Read More
  • Know your way around visual basic 2010 In this tutorial I will be showing you your way around certain tools and services you will use a lot while you follow these tutorials so first of all you will need to open up your visual basic which you have downloaded f… Read More
  • Using integers and creating new object in Visual Basic In today's tutorial I am going to be showing you how to use integer function in visual basic. Now all you need to know about integer is that it tells the program that you are making a completely new action. And to show you … Read More