The following code example demonstrates how to call the Click event of a Button on Click event of another button. The following code assumes that two Button and one TextBox controls have been instantiated on a form. On the click of the button1, we will generate the click event of the button2 if the the value of the textbox1 is numeric. Continue reading “Click event of a Button on Click event of another button in C#”
Tag: Windows Control
How to get the list of all controls of the form
The following code snippet can be use to get the list of all controls of the Windows form. In the example we are using the concept of the recursion. Continue reading “How to get the list of all controls of the form”
Dock property of control in c#
You can set the control borders to docked to its parent control through Dock property. Dock property of any control determines how a control is resized with its parent control.means how a control automatically resized as its parent control is resized. for example if you set the dock property of a control to Left, then it automatically align with the left side of its parent and it will automatically resize as the parent control is resized.

There is one point to need consider here that Anchor and Dock properties are mutually exclusive. Only one can be set at a time and the last one set takes precedence.
Example
The following c# example creates a Panel and sets some of its common properties and then set the Dock property of this to Top.
and then set the Dock property of this to Top.
private void CreatePanelAndSetDock() { Panel Pnl = new Panel(); Pnl.BackColor = Color.Gray; Pnl.Height = 50; Pnl.BorderStyle = BorderStyle.Fixed3D; this.Controls.Add(Pnl); Pnl.Dock = DockStyle.Top; }
Dock property of control in vb.net
You can set the control borders to docked to its parent control through Dock property. Dock property of any control determines how a control is resized with its parent control.means how a control automatically resized as its parent control is resized. for example if you set the dock property of a control to Left, then it automatically align with the left side of its parent and it will automatically resize as the parent control is resized

There is one point to need consider here that Anchor and Dock properties are mutually exclusive. Only one can be set at a time and the last one set takes precedence.
Example
The following example creates a Panel and sets some of its common properties and then set the Dock property of this to Top.
and then set the Dock property of this to Top.
Private Sub CreatePanelAndSetDock() Dim Pnl As New Panel Pnl.BackColor = Color.Gray Pnl.Height = 50 Pnl.BorderStyle = BorderStyle.Fixed3D Me.Controls.Add(Pnl) Pnl.Dock = DockStyle.Top End Sub
Get all Labels on a windows form using vb.net
you can find all label controls on a windows form.
Continue reading “Get all Labels on a windows form using vb.net”
Get selected items in a Checkbox List in c#
Following example shows how to get selected items from checkedlistbox in c#.
Continue reading “Get selected items in a Checkbox List in c#”
Get selected items in a Checkbox List in vb.net
The following example shows how to get selected items from CheckedListBox control in windows application using vb.net.
Continue reading “Get selected items in a Checkbox List in vb.net”
Display directory and its all sub directories in treeview in vb.net
Display directory and its all sub directories in treeview in vb.net
Continue reading “Display directory and its all sub directories in treeview in vb.net”
How to get names of all controls on a panel using vb.net
This code sample is for getting names of all control on a panel using vb.net
Continue reading “How to get names of all controls on a panel using vb.net”
How to change Textbox font at runtime using vb.net
Following example shows how to change font of the textbox at runtime in vb.net
Continue reading “How to change Textbox font at runtime using vb.net”