VB.Net - SPLessons

VB.Net Basic Application

Home > Lesson > Chapter 5
SPLessons 5 Steps, 3 Clicks
5 Steps - 3 Clicks

VB.Net Basic Application

VB.Net Basic Application

shape Description

As earlier discussed the advantage of Dot Net is drag and drop facility that every thing like buttons, list box, checkbox, etc. available in visual studio framework, creating an applications using visual basic is an interesting task why because everything will be available there only, if user click on select object automatically code of an object will be opened where developer has to write logic that exactly what client is needed. Following is a best practical example to learn and get an clarity about what is an application in Dot Net.

shape Example

Following is an example to add an items or remove an items from a list box.Where form will be opened automatically.First drag and drop an objects as required as follows. Where developer has chosen two buttons, text box, list box and changed name of those buttons also. Following is the logic code to perform an action that adding an elements and removing an elements. [c] Public Class Form1 Private Sub additem_Click(sender As Object, e As EventArgs) Handles additem.Click lb1.Items.Add(tb1.Text) lb1.SelectedIndex = lb1.SelectedIndex + 1 End Sub Private Sub remove_Click(sender As Object, e As EventArgs) Handles removeitem.Click lb1.Items.Remove(lb1.SelectedItem) End Sub End Class[/c] Output: Click on start button to compile an application, then the window will be as follows. Where a user can write an item Names and click on the Add Item button, then the item will be added to the list box. Added items will be displayed in the list box as follows. More items can be added to the list box as follows and when click Remove Item button the selected item will be deleted.

Summary

shape Points

  • In Dot Net objects code will be generated automatically.
  • Drag and Drop is an main assert to the Dot Net framework.
  • Writing validation to an application is an interesting task in Dot Net.