43. What is the importance of a Button control?
A Button control is an important Windows control, which provides the most common way of creating and handling an event in the code with the help of its Click event.
44. How can you unselect the selected items in a ListView control programmatically in .NET 4.0?
The syntax to unselect the selected items in the ListView control is shown in the following code snippets:
Code for VB:
Me.listView1.SelectedItems.Clear()
Code for C#:
this.listView1.SelectedItems.Clear();
45. How can you get the text of the RichTextBox control, including all rich text format strings in .NET 4.0?
The Rtf property of the RichTextBox control is used to set or get texts, including the RTF format code.
46. What is the use of a Timer control? Can a Timer control pause?
The Timer control is a mechanism to perform an iterative task at a specified time interval. You cannot pause it because it can only start and stop.
47. What is die difference between a CheckBox control and a RadioButton control?
A CheckBox control is square shaped; whereas, a RadioButton control is round in shape. Moreover, you can select more than one CheckBox control from a group of CheckBoxcontrols; whereas, you can select only a single RadioButton control from a group ofRadioButton controls.
48. Can you write a class without specifying a namespace? Which namespace does it belong to by default?
Yes, we can write a dass without specifying namespace and that class belongs to a global namespace that has no name.
49. What are the three states set in the CheckState property of CheckBox?
- Checked
- Unchecked
- Indeterminate
50. How can you display an icon at runtime on the StatusStrip control?
The following code snippet shows the code to display an icon at runtime on the StatusStripcontrol:
toolStripStatusLabel2.Image = Bitmap.FromFile(“D:\\Indiabix\\Images\\1.bmp”);
51. Can you add more than one item simultaneously in the ListBox control?
Yes, You can add more than one item simultaneously in the ListBox control by using theAddRange() method.
52. What is the difference between a MenuStrip control and a ContextMenuStrip control?
The difference between a MenuStrip control and a ContextMenuStrip control is that aMenuStrip control is associated with the Windows Form; whereas, a ContextMenuStripcontrol is associated with a control, which is added to the Windows Form.
53. What are the values that can be assigned to the DialogResult property of a Buttoncontrol?
The DialogResult property of a Button control can be assigned a value from theDialogResult enumerations, which are as follows:
- Abort-Returns Abort
- Cancel-Returns Cancel
- Ignore-Returns Ignore
- No-Returns No
- None-Nothing is returned from the dialog box
- OK-Returns OK
- Retry-Returns Retry
- Yes-Returns Yes
54. Why do you require user-defined controls?
User-defined controls are particularly useful in situations where you need to enhance the functionality of an existing control.
No comments:
Post a Comment