Skip to content

February 20, 2013

Let Us start learning Vb.net

Let Us start learning Vb.net,

Minimum Requirements:

  • Microsoft Visual Studio 2005
  • Microsoft SQL Server 2005

We can develop windows applications and Website application using vb.net.

 

Firstly we can look at windows application.after that we can move to website application using vb.net.

  • Open Microsoft Visual Studio 2005

image001

 

  • Then click Ctrl+Shift+N then Ok

image003

image005

  • Click Ctrl+Alt+X,then toolbar will open ,we get  all tools we need from toolbar.

image007

  • Click on button control from toolbar,button control will place in corner.we can change the position by selecting the control and drag to specified position you want.

image009

 

 

  • We can change the properties of button control via property window.press f4 to view the property window.

image011

  • Now we can change the text field , ‘Button1’ as ‘submit’

image013

  • We can code the event of button click by double clicking the submit button.Now we switch to code window here we can do the development code.

image015

We can switch back to designer window by right clicking the code view ,select view designer.

Now switch back to designer view and place a label control from toolbar.You can also change the properties from property windows by selecting the label control.Then again double click the submit button.Now we can code the label control to display hello world when clicking submit button.

Public Class Form1

 

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

Label1.Text = "Hello world"

End Sub

End Class

We simply assign Hello world string to Label control,our label control id is label1 ,we add .Text means we assigning the string to label as text.

  • We can run our code by clicking f5.

image017

  • Click on submit button.

image019

 

Now we sucessfully displays the hello world in label.

We can also hide the lable1 control,displays only when clicking submit button.swich back to code view by double click the window area outsite with out selecting any control.

 

Place the code in page load event.

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

Label1.Visible = False

End Sub

Also we need to display the label when button clicks.

Update the button click event to unhide the label control.

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

Label1.Text = "Hello world"

Label1.Visible = True

 

End Sub

image021

  • Run the code by clicking f5

image023

  • After clicking submit button

image025

 

 

You can download the article as pdf click here

You can download the source files,Download