Sunday, September 27, 2015

VB.NET CONTROLS



Explain different windows form controls in VB.Net

VB.Net contains a very rich amount of the controls for the windows application.
Every controls have three important elements which are Properties and Events
Properties means all the controls can resized, customized and moved. A property is a value or characteristics held by the particular control.
An Event means a signal that informs an application that something important has occurred.
Some of the common Properties, Method and Events of all controls are as below.


Common Properties of all controls which are listed below:

Property Name
Description
Text
Display the name of the control on the windows forms
Name
Contains the name of the controls by which the control can be identified
Minimum Size
With the help of the this property we can manage the minimum size of the control
Maximum Size
With the help of the this property we can manage the maximum size of the control
Size
With the help of the this property we can manage the size of the control
Modifier
To handle the access level of control public, private, protected or friend
Font
To set the font style of that control
TabIndex
To set the tab index of the particular control
Visible
Control should be visible or not visible we can set with this property

Common Events of all controls which are listed:

Event Name
Description
Click
When we click on the control and we have to execute any code that code will be written in this event
MouseClick
When mouse will be clicked on the control and we have to execute any code that code will be written in this event
DoubleClick
When we double click on the control and we have to execute any code that code will be written in this event
DragLeave
When we remove the mouse from the control and at that time if any code have to be executed that code will be written in this event
SizeChanged
When we changed the size of the control and at that time if any code have to be
executed that code will be written in this event




1. Form Control

The container for all the controls that make up the user interface.

Properties:

Property Name
Description
StartPosition
This property determines the initial position of the form when it's first
displayed.
MinimizeBox
By default, this property is True and you can set it to False to hide the
Minimize button on the title bar.
MaximizeBox
By default, this property is True and you can set it to False to hide the
Maximize button on the title bar.
ControlBox
By default, this property is True and you can set it to False to hide the
Minimize, Maximize and close button on the title bar.
IsMDIContainer
By default, this property is False and you can set it to True for generating
MDI application.

Events:

Event Name
Description
Load
Occurs when the form is loaded for the first time.
Closed
Occurs before the form is closed.
Closing
Occurs when the form is closing
HelpButtonClicked
Occurs when the Help button is clicked.


2. Button Control

It represents a Windows button control.

Properties:

Property Name
Description
BackColor
Gets or sets the background color of the control.
DialogResult
Gets or sets a value that is returned to the parent form when the button is
clicked. This is used while creating dialog boxes.
Image
Gets or sets the image that is displayed on a button control.
Font
Sets the font.
Size
Sets the size.
Enable
By default, this property is True and you can set it to False to disable the
working of button.



Events:

Event Name
Description
GotFocus
Occurs when the control receives focus.
TextChanged
Occurs when the Text property value changes.
Validated
Occurs when the control is finished validating.
Click
Occurs when user clicks the Button.
FontChange
Occurs when font is changed.

3. Label Control

It represents a standard Windows label.

Properties:

Property Name
Description
Autosize
Gets or sets a value specifying if the control should be automatically
resized to display all its contents.
BorderStyle
Gets or sets the border style for the control.
Text
Used to Display the text.
TextAlign
Gets or sets the alignment of text in the label.

Events:

Event Name
Description
Leave
Occurs when the input focus leaves the control.
LostFocus
Occurs when the control loses focus.
TextChanged
Occurs when the Text property value changes.

4. TextBox Control

It represents a Windows text box control.

Properties:

Property Name
Description
CharacterCasing
Gets or sets whether the TextBox control modifies the case of characters
as they are typed.
Multiline
Gets or sets a value indicating whether this is a multiline TextBox control.
PasswordChar
Gets or sets the character used to mask characters of a password in a
single-line TextBox control.
Readonly
By default, this property is True and you can set it to False to make the
text Readonly.
Visible
By default, this property is True and you can set it to False to make the
Textbox invisible.

Events:

Event Name
Description
TextAlignChanged
Occurs when the TextAlign property value changes.
TextChanged
Occurs when the text in the textbox changes.

5. RadioButton Control

It enables the user to select a single option from a group of choices when paired with other RadioButton controls.

Properties:

Property Name
Description
CheckAlign
Gets or sets the location of the check box portion of the radio button.
Checked
Gets or sets a value indicating whether the control is checked.

Events:

Event Name
Description
AppearanceChanged
Occurs when the value of the Appearance property of the RadioButton
control is changed.
CheckedChanged
Occurs when the value of the Checked property of the RadioButton control
is changed.


6. Checkbox Control

It represents a Windows CheckBox.

Properties:

Property Name
Description
CheckAlign
Gets or sets the horizontal and vertical alignment of the check mark on the
check box.
Checked
Gets or sets a value indicating whether the check box is selected.
ThreeState
Gets or sets a value indicating whether or not a check box should allow three check states rather than two.







Events:

Event Name
Description
AppearanceChanged
Occurs when the value of the Appearance property of the check box is
changed.
CheckedChanged
Occurs when the value of the Checked property of the CheckBox control is
changed.
CheckStateChanged
Occurs when the value of the CheckState property of the CheckBox control is changed.


7. ComboBox Control

It represents a Windows combo box control.

Properties:

Property Name
Description
DataBindings
Gets the data bindings for the control.
DataSource
Gets or sets the data source for this ComboBox.
DropDownStyle
Gets or sets a value specifying the style of the combo box.
Items
Add the items to be displayed.

Events:

Event Name
Description
DropDown
Occurs when the drop-down portion of a combo box is displayed.
DropDownClosed
Occurs when the drop-down portion of a combo box is no longer visible.
SelectedIndexChanged
Occurs when the SelectedIndex property of a ComboBoxhas changed.

8. ListView Control

It represents a Windows list view control, which displays a collection of items that can be displayed using one of four different views.

Properties:

Property Name
Description
Columns
Gets the collection of all column headers that appear in the control.
HeaderStyle
Gets or sets the column header style.
Items
Gets a collection containing all items in the control.





Events:

Event Name
Description
ItemCheck
Occurs when an item in the control is checked or unchecked.
ColumnClick
Occurs when a column header is clicked.
SelectedIndexChanged
Occurs when the selected index is changed.

No comments: