Windows control interview questions

61. What is the difference between a ListBox control and a ComboBox control?

With a ListBox control, the user can only make a selection from a list of items; whereas, with a ComboBox control, the user can make a selection from the list of items as well as can add custom entry and select the same.

62. What is the function of MinDate and MaxDate properties of the MonthCalender control?

The MinDate and MaxDate properties allow users to get and set the minimum and maximum allowable date.

63. Name the parent class for all Windows controls.

The Control class or System.Windows.Forms.Control class is the parent class for all Window controls.

64. What is the MaskedTextBox control? What does the Mask property do?

The MaskedTextBox control is an improvement of the TextBox control. It forces the user to provide the proper input, which is specified by the Mask property. In other words, it prevents the user to provide any invalid input to an application. The Mask property gets or sets the input type to the MaskedTextBox control. There are many built-in formats for the Mask property, such as phone no., short date, time, zip code, and custom.

65. How can you adjust the height of a combo box drop-down list?

You can control the height of a combo box drop-down list by setting the MaxDropDownItems property of the combo box. The MaxDropDownItems property sets the maximum number of entries that will be displayed by the drop-down list.

66. How can you enforce a text box to display characters in uppercase?

The TextBox class contains the CharacterCasing property, which is used to specify the case of the content for a text box. This property accepts a value from the CharacterCasing enumeration of .NET Framework. The members specified in the CharacterCasing enumeration are Lower, Upper, and Normal. You can select any one of these enumerations as a value for the CharacterCasing property of a specified text box, as shown in the following code snippet:

textBox1.CharacterCasing = CharacterCasing.Upper;

Scroll to Top