Windows Forms Controls are user interface elements in the .NET Framework used to create Windows desktop applications. They include buttons, text boxes, labels, combo boxes, and more.
You can add a Button control by dragging it from the Toolbox onto the form in the Visual Studio designer, or by creating it programmatically
The Text
property specifies the text displayed by the control. For example, it sets the label of a Button or the content of a TextBox.
You handle the Click event by creating an event handler method and associating it with the Button's Click event:
The Checked
property indicates whether the CheckBox is selected. It returns true
if checked, and false
if no.
ou create a TextBox control either by dragging it from the Toolbox or programmatically:
A ComboBox control is a drop-down list that allows users to select an item from a list or enter a new item. It combines the functionality of a text box and a list box.
What does the Enabled
property do in Windows Forms Controls?
The Enabled
property determines whether the control is interactive. If set to false
, the control is disabled, appears dimmed, and does not respond to user interactions.
You create a Label control by instantiating it and adding it to the form's Controls collection:
What is the SelectedIndex
property of a ListBox control?
The SelectedIndex
property gets or sets the zero-based index of the currently selected item in the ListBox. If no item is selected, it returns -1.