.Net windows controls interview questions

3. What is the function of the CheckState property of the CheckBox control?

The CheckState property gets or sets the state of CheckBox.

If the ThreeState property is set to false, the CheckState property value can only be set to CheckState.Indeterminate in code and not by user interaction.

Checked – The CheckBox displays a check mark. The control appears sunken.
Unchecked – The CheckBox is empty. The control appears raised.
Indeterminate – The CheckBox displays a check mark and is shaded.

14. Write a code to select an item in the ListView control programmatically in C#?

To select an item from the ListView control, you can use the following code snippet:
//Make sure the listview has focus
listview1.Focus();
listview1.Items[i].Selected = true;
15. Differentiate between a TextBox control and RichTextBox control.

The TextBox control is an input control, which allows a user to enter text to an application at runtime. By default, it allows only single line text; however, you can change its property to accept the multiline text as well as scroll bar also.

The RichTextBox control is similar to the TextBox control with the difference that it allows the user to format its text also. You can format the text in various ways, such as bold, italic, and underlined as well as change its color and font. You can save your RichTextBox value to a RTF (Rich Text Format) file and load value of RTF file to the RichTextBox control.

16. Describe the ToolTip control. How can you associate it with other controls?

The ToolTip control generates a small pop-up window with explanatory text for an element It is displayed when the user pauses the mouse for a certain period over an element/control. Tool tips provide a quick help to user to understand about that element. To associate a tool tip with other control, you need to implement the SetToolTip() method.

17. What does the DialogResult property of a Button control do?

The DialogResult property retrieves or sets a value that is returned to the parent form when the button is clicked.

18. How do you create a separator in the Menu Designer?

You can use hyphen (-) to create a separator.


Discover more from aspirant corner

Subscribe to get the latest posts sent to your email.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top

Discover more from aspirant corner

Subscribe now to keep reading and get access to the full archive.

Continue reading