[TUT]Visual Basic .NET Tutorial [Noob friendly]

Discuss about Programming here. You may release your source, post guide and even ask questions!

Moderator: wizme

HWJgavin
Master of Darkness
Master of Darkness
Posts: 375
Joined: Thu Sep 10, 2009 10:53 pm

[TUT]Visual Basic .NET Tutorial [Noob friendly]

Post by HWJgavin »

Important
Well,are you interested in taking up Visual Basic?Not just because of hacks,it must be because of pure interest that gives you the heart to learn visual basics!
______________________________

Firstly,
Get Visual Basic - http://www.microsoft.com/express/download/

Now back on the tutorial,
I know the first sight is,oh god why the hell am i learning this,its so complicating,but fear not it is actually very easy.
For the first lesson,i will teach you how to do a easy caculator with VB that i learned from a website and a book last time when i learned VB.
______________________________

Here we go!
_________
To start creating your first application, you need to click on file and select new project.
________________________________________
The dialog box will then offer you a few choices,because we will be learning to create windows application,Select Windows Form Application.
________________________________________
Great!you already created your first program with VB :P,Well lets continue,Near the bottom of the dialog,you can change the project name,WindowsApplication1 to some other name you like,Eg.ImlearningVB.After you have renamed the project, click OK to proceed then a window will popup.
________________________________________
Well this step is complicated but you should be able to do it,drag one common button into the form and change its default name to calculate.
Next, click on the calculate button and key in the following code at the source code window as shown below.
________________________________________
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim num1, num2, sum As Single
num1 = 100
num2 = 200
sum = num1 + num2
MsgBox(" Answer of " & num1 & " and " & num2 & " is " & sum)

End Sub
________________________________________
^(Do not mess up at this part!)
For your first program,you insert two textboxes , three labels and one button. The two textboxes are for the users to enter two numbers, one label is to display the multiplication operator and the other label is to display the equal sign. The last label is to display the answer.
________________________________________
The code for the caculation of multiply is

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

Dim num1, num2, product As Single
num1 = TextBox1.Text
num2 = TextBox2.Text
product = num1 * num2
Label3.Text = product

End Sub
________________________________________

End of Lesson 1
-----------
Do checkback for updates!

Credits:
vbtutor.
some videos on vb.
Tattoo is an art,i have one,so what?
Boredness
The Emperor
The Emperor
Posts: 2539
Joined: Wed Aug 26, 2009 9:50 pm
Location: Singapore
Contact:

Re: [TUT]Visual Basic .NET Tutorial [Noob friendly]

Post by Boredness »

Virtual Basic is good for beginner programmers
Donate money to my paypal account @ danielongdequan1996@hotmail.com to keep this website alive!
HWJgavin
Master of Darkness
Master of Darkness
Posts: 375
Joined: Thu Sep 10, 2009 10:53 pm

Re: [TUT]Visual Basic .NET Tutorial [Noob friendly]

Post by HWJgavin »

Will add in pictures if i have time on the next lesson.

EDIT:Btw boredness u spelled visual basic wrong :lol:
Last edited by HWJgavin on Sat Sep 12, 2009 12:38 am, edited 1 time in total.
Tattoo is an art,i have one,so what?
Ladylove
Dark Lord
Dark Lord
Posts: 121
Joined: Wed Sep 02, 2009 10:38 pm

Re: [TUT]Visual Basic .NET Tutorial [Noob friendly]

Post by Ladylove »

My time to learn. :lol:
Image
HWJgavin
Master of Darkness
Master of Darkness
Posts: 375
Joined: Thu Sep 10, 2009 10:53 pm

Re: [TUT]Visual Basic .NET Tutorial [Noob friendly]

Post by HWJgavin »

Next lesson will probably be Variables or maybe teaching you to code another program and slowly moving on to hacking,creating pranks etc.
Tattoo is an art,i have one,so what?
Ladylove
Dark Lord
Dark Lord
Posts: 121
Joined: Wed Sep 02, 2009 10:38 pm

Re: [TUT]Visual Basic .NET Tutorial [Noob friendly]

Post by Ladylove »

This will help much. 1 by 1 learning session. (:
Image
Slayer369
Headmaster of Darkness
Headmaster of Darkness
Posts: 731
Joined: Sun Aug 30, 2009 9:03 pm
Location: In your sis room

Re: [TUT]Visual Basic .NET Tutorial [Noob friendly]

Post by Slayer369 »

nice tut, it may help beginner who wanna learn programing
Image
Teddy bear killer is back?
Image
Image
HWJgavin
Master of Darkness
Master of Darkness
Posts: 375
Joined: Thu Sep 10, 2009 10:53 pm

Re: [TUT]Visual Basic .NET Tutorial [Noob friendly]

Post by HWJgavin »

Yeah,VB is actually good IMO.
Anway,i will post the next lesson tmr or today.
Tattoo is an art,i have one,so what?
wizme
Destiny General
Destiny General
Posts: 297
Joined: Sat Sep 05, 2009 1:40 pm

Re: [TUT]Visual Basic .NET Tutorial [Noob friendly]

Post by wizme »

eh i think its abit confusing, from what i see from your code, you only used 1 label , but u told use to use 3, so what i do with the other 2. i think we use the label to show the + sign and the = sign.

also how do i error check the test bos field, like if we type in alpha, an error will occur or how i can i only enable the input of numbers? thx

and also how to i build the exe file out

----------------------------------------

I found out here already.
Heres my code for adding of 2 numbers with some error checking.

Code: Select all

Public Class Form1

    Private Function myFunc1(ByVal numb1, ByVal numb2)
        Dim result As Single
        result = numb1 + numb2
        Return result
    End Function

    Private Sub calculate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles calculate.Click
        Dim num1, num2 As Single
        If TextBox1.Text = "" Then
            MsgBox("Please enter something in the 1st box!")
        ElseIf TextBox2.Text = "" Then
            MsgBox("Please enter something in the 2nd box!.")
        ElseIf Not IsNumeric(TextBox1.Text) Then
            MsgBox("Please enter numbers only.")
            TextBox1.Text = ""
        ElseIf Not IsNumeric(TextBox2.Text) Then
            MsgBox("Please enter numbers only.")
            TextBox2.Text = ""
        Else
            num1 = TextBox1.Text
            num2 = TextBox2.Text
            Label3.Text = myFunc1(num1, num2)

        End If
    End Sub
End Class
This is my SS, 2 text box and 3 label.
Image
ops ps i spell wrongly lol
Unlike science, love is like magic, there's no reason to it - wizme =)
Learn more of security, click here =)
HWJgavin
Master of Darkness
Master of Darkness
Posts: 375
Joined: Thu Sep 10, 2009 10:53 pm

Re: [TUT]Visual Basic .NET Tutorial [Noob friendly]

Post by HWJgavin »

Haha,mistaken a lil,will edit when i've time,really busy for EOYS,sorry bout that :]
Tattoo is an art,i have one,so what?
Post Reply