HostKube

Post Reply 
 
Thread Rating:
  • 1 Votes - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Tutorial] Beginning Visual Basic .NET
09-20-2007, 04:15 AM (This post was last modified: 10-08-2008 02:53 AM by xBPM07x.)
Post: #1
[Tutorial] Beginning Visual Basic .NET
.:: {VB.NET Tutorial } ::.


Contents:

Code:
[Introduction]
  [What this is]
  [Download IDE]
[Coding time]
  [Your first application]
  [Your first line of code]
  [Quiz]
  [Challenge]
[Closing]
  [Closing stuff :P]

Introduction

What this is

This is a tutorial, to help you write your first console application in VB.NET. It will teach you everything you need to know, and then test your skills at the end with a quiz, and a challenge. We will be using Microsoft's VB Express Edition (VBEE) IDE (Integrated Development Environment) for the compiling of our code. Lets get started Smile

Download IDE

In this section, I will show you how to get VBEE up and running. First, go to:

http://go.microsoft.com/fwlink/?linkid=95595

Download, install (just download everything, it is worth it later on) and then register. After that, load it up and it'll load all the resources for first-time use, then after that it'll load nice and fast.

Coding time

Your first application

All right, we start by creating a new console application. Click File, New Project, or if you wanna be quick, CTRL+N. You should be presented with this screen:

[Image: vb1.bmp]

Click Console Application, and in the "Name" field, type in "ConsolePractice", and then click OK.


[Image: vb2.bmp]

Your first line of code

Ok, with the new project we created, let us begin writing our first line of VB.NET code. You should see this window:

http://nevercracker.byteforums.com/images/vb3.bmp

This is where we type our code. Let us begin:

Code:
Module Module1

    Sub Main()
        System.Console.WriteLine("This is my first VB.NET application.")
        System.Console.WriteLine("Press enter to exit.")
        System.Console.ReadLine()
    End Sub

End Module

That wasn't too bad, was it? Now, press F5, to run/compile your code. You should get a message box like this:

[Image: vb4.bmp]

Now, lets do something a bit more advanced:

Code:
Module Module1

    Sub Main()
        System.Console.WriteLine("This is my first VB.NET application.")
        System.Console.Write("What is your name? ")
        Dim name As String
        name = System.Console.ReadLine()
        System.Console.WriteLine("Hello " & name & ".")
        System.Console.WriteLine("Press enter to exit.")
        System.Console.ReadLine()
    End Sub

End Module

Press F5, and look at the results. They should look something like this:

[Image: vb5.bmp]

Now, lets explain what all this code does.

Module = Duh, a module
Sub = A function, main being the, well, main function
System = Namespace
Console = System class
WriteLine/Write = A sub of console which is a class of the namespace system, output text to the screen
Dim = Declare a variable/object
ReadLine = Retrieve input from user

Thus, your first application is born! ^^

Quiz

Answer the following questions with honesty, and post your results, please Smile

1. How do you declare a function?
2. How do you output text to the screen?
3. How can you retrieve input from the user?
4. What does VB stand for?
5. Is "system" a namespace, or a class?
6. How do you declare an integer, provide source code.

Challenge

All right, think you're ready? Using all the skills you learned in this tutorial, create this application:

[Image: vb6.bmp]

Can't do it, or need some help? Then go here:

http://nevercracker.byteforums.com/vbs.txt


Closing

Video tutorial

It it not matched with the tutorial, it is just a video on VB.NET I made. Watch if if you want. I will make a video tutorial in-depth on request.

http://nevercracker.byteforums.com/vb/vb.htm

Or, the direct link to the SWF file:

http://nevercracker.byteforums.com/vb/vb.swf

Well, thats it. I will release more tutorials on request, if you guys liked this one. Until then, peace!

[Image: GHST_Sig.png]

Epic quote: "Posts should be as short as short skirts, short enough to cover enough, not too long that it covers too much."
Visit this user's website Find all posts by this user
Quote this message in a reply
10-04-2007, 06:31 AM (This post was last modified: 10-04-2007 06:36 AM by KyleBooze.)
Post: #2
RE: [Tutorial] Visual Basic .NET
im a bit confused.. do u have xfire so i can ask some questions?

nvm, i got it... i think i just put something in wrong Tongue
still, wats ur xfire? Wink

[Image: 16kcg8x.jpg]
[Image: KyleBoozeArkieSig1new.gif]
Find all posts by this user
Quote this message in a reply
10-04-2007, 06:35 AM (This post was last modified: 10-04-2007 07:37 AM by xBPM07x.)
Post: #3
RE: [Tutorial] Visual Basic .NET
I have MSN. Erm, I can login to XFire for you though, but I don't normally do this Wink

What is your XFire name?

NeverCracker is mine, I added you ^^

[Image: GHST_Sig.png]

Epic quote: "Posts should be as short as short skirts, short enough to cover enough, not too long that it covers too much."
Visit this user's website Find all posts by this user
Quote this message in a reply
10-04-2007, 07:46 AM
Post: #4
RE: [Tutorial] Visual Basic .NET
Can you tell me what i did wrong here?

Quote:Module Module1

Sub Main()
System.Console.WriteLine("Application coded by: KyleBooze")
System.Console.ReadLine()
Dim name As String
name = System.Console.ReadLine()
System.Console.WriteLine("Name: " & name & " ")
Dim number As String
number = System.Console.ReadLine()
System.Console.WriteLine("Favorite Number: " & number & " ")
Dim skill As String
skill = System.Console.ReadLine()
System.Console.WriteLine("VB.NET skill level: " & skill & " ")
System.Console.ReadLine()
System.Console.WriteLine("Your name is " & name & ", your favorite number is " & number & ", and your VB.NET skill level is " & skill & "")
System.Console.ReadLine()
End Sub

End Module

[Image: 16kcg8x.jpg]
[Image: KyleBoozeArkieSig1new.gif]
Find all posts by this user
Quote this message in a reply
10-04-2007, 02:19 PM
Post: #5
RE: [Tutorial] Visual Basic .NET
i wasnt taught that way, i usally declare all the variables b4 i go and put in the console.writeline stuff

such as

Code:
Dim sentence1 as string
Dim Sentence2 as String


Console.Writeline( Sentence1 + Sentence2 )

etc

Find all posts by this user
Quote this message in a reply
10-04-2007, 06:03 PM
Post: #6
RE: [Tutorial] Visual Basic .NET
It really is up to you Clarkii, both ways work fine. I ust perfer decarling them when I need them, rather than think about all the ones I need and put them all in top.

And to answer your question, Kyle:

Code:
Module Module1

    Sub Main()
        System.Console.WriteLine("Application coded by: KyleBooze")
        System.Console.ReadLine()
        Dim name As String
        System.Console.Write("Name: ")
        name = System.Console.ReadLine()
        Dim number As Integer
        System.Console.Write("Favorite Number: ")
        number = System.Console.ReadLine()
        Dim skill As String
        System.Console.Write("VB.NET skill level: ")
        skill = System.Console.ReadLine()
        System.Console.WriteLine("Your name is " & name & ", your favorite number is " & number & ", and your VB.NET skill level is " & skill & "")
        System.Console.ReadLine()
    End Sub

End Module

What you did wrong was:

Dim number as string 'you need to declare it as an integer

Dim name As String
name = System.Console.ReadLine() 'you dont accept input yet, you ask them for thier name first!
System.Console.WriteLine("Name: " & name & " ") 'You don't output the variable the user didn't type yet!

Compare our code, and think about what you did wrong. Then, if you have any specific questions ask me.

[Image: GHST_Sig.png]

Epic quote: "Posts should be as short as short skirts, short enough to cover enough, not too long that it covers too much."
Visit this user's website Find all posts by this user
Quote this message in a reply
10-04-2007, 11:28 PM
Post: #7
RE: [Tutorial] Visual Basic .NET
ok thx Big Grin ... ill practice that a few times to get it in my memory ^^

[Image: 16kcg8x.jpg]
[Image: KyleBoozeArkieSig1new.gif]
Find all posts by this user
Quote this message in a reply
Post Reply 


Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  [Tutorial] Unpacking/Cracking Combat Arms xBPM07x 7 6,565 10-05-2009 07:11 PM
Last Post: hawkclaw
  [Tutorial] Beginning C xBPM07x 0 1,929 08-14-2008 04:02 AM
Last Post: xBPM07x
Question Visual Basic Tutorial Help KyleBooze 1 632 10-22-2007 01:24 AM
Last Post: xBPM07x
  Visual basic detecting movement Birdie 2 517 07-28-2007 10:21 PM
Last Post: Birdie

Forum Jump:

Contact UsByte ForumsReturn to TopReturn to ContentLite (Archive) ModeRSS Syndication