Windows Controls (Part - 2), .NET Interview Questions Quant Notes | EduRev

Placement Papers - Technical & HR Questions

Quant : Windows Controls (Part - 2), .NET Interview Questions Quant Notes | EduRev

The document Windows Controls (Part - 2), .NET Interview Questions Quant Notes | EduRev is a part of the Quant Course Placement Papers - Technical & HR Questions.
All you need of Quant at this link: Quant

35. How can you prevent users of an application from editing the text in the ComboBox controls in .NET 4.0?

The ComboBox class contains the DropDownStyle property, which is used to define the display style of the items in the ComboBox control. The DropDownStyle property accepts a value from the ComboBoxStyleenumeration, which contains three members to define the styles for the items: SimpleDropDownList, and DropDown. The DropDownList value of the ComboBoxStyle enumeration is selected to set a ComboBox control as non-editable by users, as shown in the following code snippets:

Code for VB:

ComboBox1.DropDownStyle = ComboBoxStyle.DropDownList

Code for C#:

ComboBox1.DropDownStyle = ComboBoxStyle.DropDownList;

36. Which class manages the event and layout of all ToolStrip elements?

The ToolStripItem class manages the event and layout of all elements that the ToolStrip control contains.

37. How can you place a border around a picture box?

The PictureBox control offers the BorderStyle property, which can be set to define the style of its border. This property can accept any of the three values from Fixed3DFixedSingle, or None. These properties can be easily set through code or through the Properties window of the Visual Studio IDE.

38. How do we format numbers, dates, and currencies in a text box?

Each type has a ToString() method that can used to format date, currencies, and numbers. You can also use the String.Format() method to format these things as well. To format dates, use the ToString() member of the DateTime type.

39. What is the use of the Panel control? Does it display at runtime?

Panels acts as a container to group other controls. It is an important control, when you want to show/hide a group of controls and relocate a number of controls simultaneously.

When you generate a new control at runtime, it works as a container control. As we know, it is a container control; therefore, it is not displayed at runtime.

40. Is it possible to add an image on the RadioButton control?

Yes, you can add an image on the RadioButton control by setting the Image property.

41. What is the use of a toolstrip container?

A toolstrip container is used to contain controls, such as ToolStripMenuStrip, and StatusStrip, so that these controls can be docked and moved at the run time.

42. Name the methods, available in .NET 4.0, that are used to add and delete items from a ListBox control?

The following methods can be used to add and delete items from a ListBox control. The Items.Add() and Items.Insert() methods are used to add items; whereas, the Items.Remove()Items.RemoveAt(), and Items.Clear() methods are used to delete items from a ListBox control.

43. What is the importance of a Button control?

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:


Code for C#:


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?

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 CheckBox controls; whereas, you can select only a single RadioButton control from a group of RadioButton 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 StatusStrip control:

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 the AddRange() 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 a MenuStrip control is associated with the Windows Form; whereas, a ContextMenuStrip control 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 Button control?

The DialogResult property of a Button control can be assigned a value from the DialogResultenumerations, 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.

55. Is it possible to enter more than one line in a TextBox control?

Yes, it is possible to enter more than one line in a TextBox control. To do this, you need to set the Multilineproperty of the TextBox control to True. You can set this property at design time as well as runtime. The syntax to set this property at runtime is as follows:

Textbox1.Multiline = true;

56. How can you enable a text box to change its characters format, so that users can enter password?

You can set the PasswordChar property of the TextBox class to True to enable it to accept passwords. The code to change the PasswordChar property of the TextBox class is given as follows: 

textBox1.PasswordChar = '*';

57. What does the TickFrequency property of the TrackBar control do?

The TickFrequency property gets or sets a value that specifies the distance between ticks. By default, the distance between ticks is 1.

58. Is it possible to associate a control with more than one ContextMenu control?

No, we cannot associate a control with more than one ContextMenu control.

59. What is the difference between the Panel and GroupBox control?

The Panel and GroupBox controls both can be used as a container for other controls, such as radio buttons and check box. The main differences between a Panel and a GroupBox control are as follows:

  • Panel does not display captions, while GroupBox do
  • Panel has scrollbar, while GroupBox does not

60. Does a Timer control appear at run time?

Timer is a component; therefore, it does not appear at run time.

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 ComboBoxcontrol, 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 LowerUpper, 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;

67. Is it possible to associate a control with more than one ContextMenu?

No, we cannot associate a control with more than one ContextMenu.

68. How can you check/uncheck all items in the CheckedListBox control in .NET 4.0?

To check all items in .NET, you can use the following code snippet:

Code for VB:

Dim i as Integer
For i = 0 To myCheckedListBox.Items.Count - 1
myCheckedListBox.SetItemChecked(i, True)

Code for C#:

for( int i = 0; i < myCheckedListBox.Items.Count; i++ )
 myCheckedListBox.SetItemChecked(i, true);

69. How can we disable the context menu for a TextBox control?

The TextBox class contains the ContextMenuStrip property. When we set this property to a dummy instance of the ContextMenu class, the TextBox control is unable to provide any context menu on the right-click of the mouse.

70. How can you move and resize a control on a Windows form?

You can make use of the SetBounds() method to move as well as resize the control on a Windows form.

71. What is use of the DropDownStyle property of the ComboBox control?

The DropDownStyle property changes the style of the ComboBox control. It consists of SimpleDropDown, and DropDownList as its values. When you select Simple, the list of items are displayed as a ListBoxcontrol. When you select DropDown, the list is displayed in a drop down style. When you select DropDownList, the list displayed in a drop down style and you cannot edit its text.

72. What is the difference between pixelspoints, and em's when fonts are displayed?

pixel is the lowest-resolution dot that the computer monitor supports. Its size depends on user's settings and the size of the monitor. A point is always 1/72 of an inch. An em is the number of pixels it takes to display the letter M.

Offer running on EduRev: Apply code STAYHOME200 to get INR 200 off on our premium plan EduRev Infinity!

Dynamic Test

Content Category

Related Searches

mock tests for examination


Windows Controls (Part - 2)






.NET Interview Questions Quant Notes | EduRev


Viva Questions


Extra Questions


video lectures


Semester Notes


Previous Year Questions with Solutions


past year papers




practice quizzes


shortcuts and tricks


.NET Interview Questions Quant Notes | EduRev




.NET Interview Questions Quant Notes | EduRev


Important questions


Sample Paper


Windows Controls (Part - 2)


Objective type Questions


Windows Controls (Part - 2)






study material