After installing Visual Studio, you are now ready to create first ASP.NET application with VB.NET. Follow these steps.

Step-1 Select the Appropriate Project Type and Template

Run Visual Studio and click the “New Project” option in this screen.

Create First ASP.NET Application

  1. Select option “Visual Basic” from the templates section
  2. Click on “Web” Option from the “Windows” list
  3. Ensure that you have “ASP.NET Web Application” selected in the detailed pane
  4. Change the name of the application
  5. If you want the web application to be stored in a specific directory click “Browse” Button and select the appropriate directory from the dialog box
  6. Click OK to select the template for this web application

select ASP.NET Web Application

From the dialog box appearing

  1. Select the “Empty” template
  2. Check the “Web Forms” checkbox
  3. Click OK to create solution for this web application

Select Template

If a dialog box appears asking you to register with Azure, just click “Cancel” button and proceed to solution window.

Step-2 Create a Web Form

Now you need to add web form to create your first ASP.NET Web application that contains the controls to let the users interact.

  1. Right Click on “myFirstWebApp” Project
  2. Click on “Add”
  3. Click on “Web Form” to add a new Web Form in the project

AddWebForm

 

Type the name you want to give to this form and click OK

LoginForm

By default you will be presented with the source of this web form. To design the from you have to select the Design option.

WebFormDesign

Step-3 Place Web Controls on the Web Form

From the Toolbox on left use 2 Labels, 2 Textboxes and one Button to create the interface. Also change the names of the controls you just placed (txtUserName, txtDepartment and btnLogin)

create form interface

Step-4 Place Code in the btnLogin_Click event

To make the form interactive add the code in the .vb file of the Web Form. To do this in the design view double-click the btnLogin button to open the code window and type the following code in the click event.

MsgBox(" User " & txtUserName.Text & " of Department " & txtDepartment.Text & " is allowed to login")

Completed the task now See the output

From the toolbar section click on the option “Google Chrome” to run your newly created webform in your browser.

It will look like this. Enter the values in the textboxes and click the “Click to Login” Button.

This message will popup to display the names that you have entered in the text boxes.