Home Python C Language C ++ HTML 5 CSS Javascript Java Kotlin SQL DJango Bootstrap React.js R C# PHP ASP.Net Numpy Dart Pandas Digital Marketing

.Net programming Interviews Questions


Window Controls in .NET question and answers

Q.1. What are Windows Forms Controls in .NET?

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.

Q.2 How do you add a Button control to a Windows Form in .NET?.

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

Button button = new Button();
button.Text = "Click Me";
this.Controls.Add(button);

Q.3 What is the purpose of the Text property in Windows Forms Controls?

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.


Q.4 How do you handle the Click event of a Button in a Windows Form?.

You handle the Click event by creating an event handler method and associating it with the Button's Click event:

button.Click += new EventHandler(Button_Click);
private void Button_Click(object sender, EventArgs e) {
// Handle the click event
}

Q.5 What is the Checked property in a CheckBox control?

The Checked property indicates whether the CheckBox is selected. It returns true if checked, and false if no.


Q.6 How do you create a TextBox control in a Windows Form?

ou create a TextBox control either by dragging it from the Toolbox or programmatically:

TextBox textBox = new TextBox();
this.Controls.Add(textBox);

Q.7 What is a ComboBox control in Windows Forms?.

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.

Q.8

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.

.

Q.9 How do you create a Label control in a Windows Form?

You create a Label control by instantiating it and adding it to the form's Controls collection:

Label label = new Label();
label.Text = "Hello, World!";
this.Controls.Add(label);

Q.10

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.

.



Advertisement





Q3 Schools : India


Online Complier

HTML 5

Python

java

C++

C

JavaScript

Website Development

HTML 5

Python

java

C++

C

JavaScript

Campus Learning

C

C#

java