.Net Windows Controls Interview Questions and Answers for Freshers and Experience Part-3
13. 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 toCheckState.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
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 theSetToolTip() 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.