Exforsys

VB.NET 2005

  1. VB.NET 2005 Free Training
  2. The .NET Framework Architecture Part 1
  3. The .NET Framework Architecture Part 2
  4. Application Class and Message Class
  5. Implementing Class Library Object
  6. Visual Studio.NET Namespaces
  7. .NET Assemblies
  8. Differences between VB.NET 1.0 and VB.NET 2.0
  9. Introducing VB.NET Windows Forms
  10. Visual Studio Windows Forms Designer
  11. Exploring the Forms Designer generated code
  12. Setting and Adding Properties to Windows Form
  13. Implementing Inheritance
  14. Event Handling In Visual Basic .NET
  15. Building Graphical Interface elements
  16. .NET Common Windows Forms Controls Part 1
  17. .NET Common Windows Forms Controls Part 2
  18. Common Controls and Handling Control Events
  19. DomainUpDown and NumericUpDown Controls
  20. Dialog Boxes in Visual Basic .NET
  21. Visual Studio Adding Controls to Windows Form
  22. VB.NET Validation Controls
  23. Working with Menu Controls
  24. VB.NET MDI Applications
  25. .NET Exceptions
  26. VB.NET Creating and Managing Components Part 1
  27. VB.NET Creating and Managing Components Part 2
  28. Simple Data Binding
  29. .NET Complex Data Binding
  30. .NET Data Form Wizard
  31. Data Manipulation with ADO.NET
  32. SQL Server Stored Procedures
  33. SQL Server Ad Hoc Queries
  34. Finding and Sorting Data in DataSets
  35. ADO.NET Object Model
  36. Working with DataSets
  37. Using XML Data
  38. Working with File System in .NET
  39. Creating Web Service
  40. Instantiating - Invoking Web Services, Creating Proxy Classes with WSDL
  41. Web Reference and Web Services
  42. Web Services - SOAP, WSDL, Disco and UDDI
  43. Web Application Testing in VB.NET 2005
  44. Web Application Tracing and Debugging
  45. Working with Legacy Code and COM Components
  46. ActiveX Controls and Legacy Code
  47. Windows Application Testing
  48. VB.NET Windows Application Testing
  49. Tracing VB.NET Windows Application
  50. Debugging Windows Applications In Visual Studio.NET 2005
  51. Deploying Windows Applications In Visual Studio.NET 2005
  52. Customizing Setup Project in Visual Studio.NET 2005
  53. Shared Assembly
  54. Microsoft .NET Creating Installation Components
  55. The Registry Editor in Visual Studio.NET 2005
  56. The File Types Editor

Ads


Home arrow Technical Training arrow VB.NET 2005

.NET Common Windows Forms Controls Part 1 Page - 3

Page 3 of 3
Author : Exforsys Inc.     Published on: 26th Jun 2005    |   Last Updated on: 6th Apr 2011

.NET Common Windows Forms Controls Part 1

Buttons

Buttons provide for the most common way of creating and handling events in the code. It exposes the common properties and the methods that help us use this control.

Ads

CheckBoxes

Check Boxes are controls that you click to select it and click it again to deselect it. This control can be ideally used when getting user input for answers of the type yes or no. Open a new project and on the Form1 you can add three check boxes, a label and a command button. Type the following codes in the code behind form:

Click here for the Sample Code

The following screenshots illustrate the performance of the program:

The screenshot shown below shows the initial screen. Note the label message that says that you have not clicked on any of the check box:

The following screenshot shows that the checkbox two is clicked:

The following screenshot shows that the checkbox is unchecked and label message has changed:

RadioButtons

Radio buttons are also checkboxes and the difference lies in the following areas:

1. They are round as against the checkboxes which are square

2. they are used mostly in groups

While checkboxes are used individually, the radiobuttons are use in groups. In case of the radiobuttons, if you check button 3 after clicking button1 the button1 is deselected automatically.

Let us see an illustration: The following code gives the demo for the radiobutton:

Click here for the Sample Code

The following screenshot shows the output:


ListBox

A List box is a useful tool that helps you to display a list of several items from which you can select one or more. A scrollbar is automatically added to the list box when the number of items in the list box increases.

1. To a new Form add a listbox from the toolbox.

2. Locate the property items in the property sheet.

3. Click on the collections on the other side.

4. A new dialog box is opened.

5. Add the items to this dialog box.

6. You must type one item per line.

7. On closing the dialog box the items added to the listbox are available.

8. Enter the following lines of code in the code.

Public Class Form1

Private Sub ListBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged

Label1.Text = "Item " & ListBox1.SelectedIndex + 1 & " is Selected"

End Sub

End Class

Now if you execute the program by pressing F5, you will see the following output:

You can also add items to the listbox at runtime by using the following line of code:

Listbox1.Items.Add(“Item10”)

In the same way you can also remove the items from the the listbox:

Listbox1.Items.Remove(ListBox1.SelectedItem)

Checked listbox

Checked listbox is derived from standard listbox control. In this case you can see a check box at the side of the item list. To check an item, the user has to double-click a checkbox by default. But you can also do it by single click if you set the CheckOnClick property to true. A screenshot of the application executed is given below:

ComboBox

Ads

This control is a frequently used control. This control is made up of two parts. The top part is a text box that allows user to enter data. The other part is a list box that allows the user to select from the items listed. You can allow the user to type in an item or select an item from the list.



 
This tutorial is part of a VB.NET 2005 tutorial series. Read it from the beginning and learn yourself.

VB.NET 2005

  1. VB.NET 2005 Free Training
  2. The .NET Framework Architecture Part 1
  3. The .NET Framework Architecture Part 2
  4. Application Class and Message Class
  5. Implementing Class Library Object
  6. Visual Studio.NET Namespaces
  7. .NET Assemblies
  8. Differences between VB.NET 1.0 and VB.NET 2.0
  9. Introducing VB.NET Windows Forms
  10. Visual Studio Windows Forms Designer
  11. Exploring the Forms Designer generated code
  12. Setting and Adding Properties to Windows Form
  13. Implementing Inheritance
  14. Event Handling In Visual Basic .NET
  15. Building Graphical Interface elements
  16. .NET Common Windows Forms Controls Part 1
  17. .NET Common Windows Forms Controls Part 2
  18. Common Controls and Handling Control Events
  19. DomainUpDown and NumericUpDown Controls
  20. Dialog Boxes in Visual Basic .NET
  21. Visual Studio Adding Controls to Windows Form
  22. VB.NET Validation Controls
  23. Working with Menu Controls
  24. VB.NET MDI Applications
  25. .NET Exceptions
  26. VB.NET Creating and Managing Components Part 1
  27. VB.NET Creating and Managing Components Part 2
  28. Simple Data Binding
  29. .NET Complex Data Binding
  30. .NET Data Form Wizard
  31. Data Manipulation with ADO.NET
  32. SQL Server Stored Procedures
  33. SQL Server Ad Hoc Queries
  34. Finding and Sorting Data in DataSets
  35. ADO.NET Object Model
  36. Working with DataSets
  37. Using XML Data
  38. Working with File System in .NET
  39. Creating Web Service
  40. Instantiating - Invoking Web Services, Creating Proxy Classes with WSDL
  41. Web Reference and Web Services
  42. Web Services - SOAP, WSDL, Disco and UDDI
  43. Web Application Testing in VB.NET 2005
  44. Web Application Tracing and Debugging
  45. Working with Legacy Code and COM Components
  46. ActiveX Controls and Legacy Code
  47. Windows Application Testing
  48. VB.NET Windows Application Testing
  49. Tracing VB.NET Windows Application
  50. Debugging Windows Applications In Visual Studio.NET 2005
  51. Deploying Windows Applications In Visual Studio.NET 2005
  52. Customizing Setup Project in Visual Studio.NET 2005
  53. Shared Assembly
  54. Microsoft .NET Creating Installation Components
  55. The Registry Editor in Visual Studio.NET 2005
  56. The File Types Editor
 

Comments