[TUTORIAL'S]Visual Basic Coding

Posts 15 of 5 · Page 1 of 1
[TUTORIAL'S]Visual Basic Coding
Hello and welcome to my tutorial, we are going to download a coding software called Visual Basic.



1) Download: Microsoft Express Downloads

2) Follow the directions from the setup. In the setup select Visual basic.

Quote Originally Posted by MSDN / Wiki
Visual Studio 2008 Express Editions are free development tools.
Register your product within 30 days from installation.

Microsoft Visual Studio Express is a set of freeware[1] integrated development environments (IDE) developed by Microsoft that are lightweight versions of the Microsoft Visual Studio product line. The idea of express editions, according to Microsoft, is to provide streamlined, easy-to-use and easy-to-learn IDEs for users other than professional software developers, such as hobbyists and students. The final versions were released on November 19, 2007 and the service pack 1 versions were released on August 11, 2008. In line with popular demand since the Visual Studio 2005 Express Editions,[2] these editions will always remain free-of-charge. Visual Studio 2008 Express Editions require Windows XP or a later Windows version; Windows NT 4.0, Windows 2000 and Windows 9x are no longer supported. Visual Studio 2005 Express Editions can be installed on Windows 2000 SP4. As of late April 2009, Microsoft has discontinued all previous versions of Visual Studio Express, including 2005. It is no longer possible to obtain these previous versions from the Microsoft website.
2# - Hello World | Basic's of Visual Basic
Welcome to my second tutorial.

In this tutorial im going to show and teach you the Hello World program.

Quote Originally Posted by Wikipedia
A "Hello World" program is a computer program which prints out "Hello, world!" on a display device. It is used in many introductory tutorials for ...
First create a new project.



2)Now you got this go to the right side and you find text, rename it.


3)Go to the toolbar, left side. If you cant find it go to, view, toolbar.

4)And double click on the button in the toolbar in left side. You have now created a button.

5) Rename the button as you did in step 2.


6) Now double click on the button on the form.

Now the actually coding starts so start typing..

We are going to create an messagebox.
Messagebox and be done in many diffrent ways and im going to teach you the easiest way.

7) Type this if you copy the code below, you wont learn anything. Better type with your own hands not mine....


[php]Msgbox("This is my first program") [/php]

8) Now debug it.

9) Press the button and your message's show's up.


-End of tutorial.
[Tutorial] 3# - Login system | Simple
Welcome to my third tutorial. In this tutorial im going to show you how to make a simple login system.

1) Create a new project and name it anything you want.

2) Add 1 button, 2 labels and 2 textboxes from the toolbar.



3) Make it look like this:



4) Now right click on the password textbox and select properties.

5) Make "usesystemchar = true".



The word says it all


Now the coding begins


6) Double click on the Login button.

7) We are now going to use the If class.




You are now done, congrats.

8. Now debug it. If you enter wrong username or password you will get this error:



and if you enter the right one:


-Hej
4# - Messagebox | Advanced
Tutorial #4

In this tutorial im going to show you how to make and use difficult messageboxes.

To make an yes & no messagebox you can use this code

[php] Dim Message As MsgBoxResult = MsgBox("Messagehere", MsgBoxStyle.YesNo, "Title")

If Message = MsgBoxResult.Yes Then
' Do something
Else
' Do something
End If[/php]

If you want an "normal" messagebox you can use any of the following codes:

[php]Interaction.MsgBox("MessageHERE", MsgBoxStyle.OkOnly, "Title")[/php]

or:

[php] MessageBox.Show("Messagehere", "Title", MessageBoxButtons.OK)[/php]

or:

[php] MsgBox("MessageHERE", MsgBoxStyle.OkOnly, "TITLE")
[/php]

Also if you want to make error messageboxes or warnings, you should read this: MsgBox Function (Visual Basic)

For the ppl who want to learn more, try understand this and how this code works:

[php]Dim msg As String
Dim title As String
Dim style As MsgBoxStyle
Dim response As MsgBoxResult
msg = "Do you want to continue?" ' Define message.
style = MsgBoxStyle.DefaultButton2 Or _
MsgBoxStyle.Critical Or MsgBoxStyle.YesNo
title = "MsgBox Demonstration" ' Define title.
' Display message.
response = MsgBox(msg, style, title)
If response = MsgBoxResult.Yes Then ' User chose Yes.
' Perform some action.
Else
' Perform some other action.
End If[/php]

End of tut

-hej
5# - Dim Statement | Hard
In Visual Basic variables is called "Dim Statement".

Dim statement is one thing you must learn to get somewhere in coding.
Quote Originally Posted by MSDN
Dim Statement: Declares and allocates storage space for one or more variables.
In Visual Basic you can use this in many diffrent ways and im going to show/teach you the most used variables.

String
[php]Dim Message as String = "Message HERE"

msgbox(message)[/php]

or:

[php]Dim Message as String = textbox1.text

msgbox(message)[/php]

Boolean
Boolean is a value of only True or False.

[php]Dim A As Boolean = True

If A = True Then
MsgBox("A is " & A.ToString)
End If[/php]

Byte


Quote Originally Posted by MSDN
Byte Data Type
Holds unsigned 8-bit (1-byte) integers ranging in value from 0 through 255.
Use the Byte data type to contain binary data.

The default value of Byte is 0.

[php]Dim BinaryData as byte[/php]

Char
Quote Originally Posted by MSDN
Holds unsigned 16-bit (2-byte) code points ranging in value from 0 through 65535. Each code point, or character code, represents a single Unicode character.

Use the Char data type when you need to hold only a single character and do not need the overhead of String. In some cases you can use Char(), an array of Char elements, to hold multiple characters.

The default value of Char is the character with a code point of 0.
[php]Dim VarChar As Char[/php]

Decimal

Quote Originally Posted by MSDN
Holds signed 128-bit (16-byte) values representing 96-bit (12-byte) integer numbers scaled by a variable power of 10. The scaling factor specifies the number of digits to the right of the decimal point; it ranges from 0 through 28. With a scale of 0 (no decimal places), the largest possible value is +/-79,228,162,514,264,337,593,543,950,335 (+/-7.9228162514264337593543950335E+28). With 28 decimal places, the largest value is +/-7.9228162514264337593543950335, and the smallest nonzero value is +/-0.0000000000000000000000000001 (+/-1E-28).
[php]Dim Dec As Decimal = 5,3
msgbox(dec)
[/php]

Integer
The Visual Basic Integer variable type is used to store whole numbers between -2,147,483,648 and 2,147,483,648. The Integer variable cannot be used to store numbers containing decimals.

[php]Dim IntegerNumber as integer = 5

msgbox("Number is" & integernumber.tostring)
[/php]


Credits: Techotopica, me, MSDN
Quote Originally Posted by Techotopica
Boolean Variable

The Visual Basic Boolean variable type holds a value of true or false. Internally these are actually stored as the numbers 1 and 0 representing true and false respectively. Boolean values are used in conditional statements to decide whether particular parts of Visual Basic code should be executed or not (see Visual Basic Flow Control for more details on conditional statements).
Char Variable


The Char variable type holds a single character (such as the letter 'B'). The value of a Char can be any character. Internally, a number in the range 0 to 65,553 is used to represent the character value as defined by the ASCII table. As an example when the letter 'Z' is assigned to a Visual Basic Char variable, the number 90 is actually stored in the variable location.
Byte Variable

A Byte variable holds a positive number in the range 0 to 255. Because of the limited range, Byte variables should be used with caution. An attempt to assign a negative value or a value greater than 255 to a Visual Basic Byte variable will result in an error.
Date Variable

The Visual Basic Date variable type holds a date and time value. Dates are declared in the form #mm/dd/yyyy#. For example, May 23, 2007 would be declared as #5/23/2007#. Visual Basic provides a number of mechanisms for working with Date variables (such as calculating a date six months from today's date). These are covered in the Working with Dates and Times in Visual Basic section of this book.
Decimal Variable

The Decimal variable type can store either a whole number or a decimal number up to 29 decimal places. When working with whole numbers, however, it is recommended that the Integer variable type be used as this is more memory efficient than the Decimal variable type.
Double Variable

The Visual Basic Double variable is used to store either very large numbers, or small numbers requiring more than 28 decimal places. To be precise Visual basic Double variables can store positive numbers in the range 4.94065645841246544E-324 to 1.79769313486231570E+308 and negative numbers from -1.79769313486231570E+30 to -4.94065645841246544E-324.
Double variables are typically used when developing scientific applications using Visual Basic and, as such, are generally not used by the average developer.
Integer Variable

The Visual Basic Integer variable type is used to store whole numbers between -2,147,483,648 and 2,147,483,648. The Integer variable cannot be used to store numbers containing decimals.
Object Variable

The Object variable is a catch-all variable type which can be used to store a value of any data type. Because of this flexibility, an Object variable will typically reserve more memory than is needed for most variable types. For this reason, it is more efficient to use the correct variable type for the value you need to store (such as Char for a character or Integer for a whole number) rather than use the Object variable type.
Long Variable

The Visual Basic Long variable type is used to store whole numbers ranging from -9,233,372,036,854,775,808 to 9,233,372,036,854,775,807.
Short Variable

A Short variable in Visual Basic stores a whole number in the range -32,768 to 32,767.
String Variable

The String variable type stores multiple characters that make up words or sentences. String variables are encapsulated in double-quotation marks ("). For example "Hello" is a string, as is "Hello, this is a test".
Visual Basic provides a number of mechanisms for working with and manipulating strings as covered in the Working with Strings in Visual Basic chapter of this book.
End of tutorial

-Hej
Posts 15 of 5 · Page 1 of 1
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Need help?