Windows Controls Interview Questions & Answers

  1. Question 1. How Can We Auto Size A Button To Fit Its Text?

    Answer :

    The Button control has the AutoSize property, which can be set to true or false. If we set the value of the AutoSize property to true, then the button control automatically alters its size according to the content displayed on it.

  2. Question 2. How Can We Display An Icon Or A Bitmap Image On The Button Control?

    Answer :

    The Button class contains the Image property, which is used to set an image on the Button control. We can also set the alignment of the image by using the Image Align property of the Button class.

  3. Programmable Logic Controller (PLC) Interview Questions

  4. Question 3. How Is Anchoring Different From Docking?

    Answer :

    Docking refers to attaching a control to either an edge (top, right, bottom, or left) or the client area of the parent control. On the other hand, anchoring is a process in which you need to specify the distance that each edge of your control maintains from the edges of the parent control.

  5. Question 4. How Can You Programmatically Position The Cursor On A Given Line Or On A Character In The Richtextbox Control In C#?

    Answer :

    The RichTextBox control contains the Lines array property, which displays one item of an array in a separate line. Each line entry has a Length property,

    which can be used to accurately position the cursor at a character, as shown in the following code snippet:

    private void GoToLineAndColumn(RichTextBox RTB, int Line, int Column)


     int offset = 0;

     for(int i = 0; i < Line -1 && i < RTB.Lines.Length; i++)  {  offset += RTB.Lines[i].Length + 1;  }  RTB.Focus();  RTB.Select(offset + Column, 0); }

  6. Control Systems Tutorial

  7. Question 5. What Is The Difference Between The Windows Default Location And Windows Default Bounds Properties?

    Answer :

    The Windows Default Location property makes the form to start up at a location selected by the operating system, but with internally specified size. The Windows Default Bounds property delegates both size and starting position choices to the operating system.

  8. DCS(distributed control system) Interview Questions

  9. Question 6. What Is The Function Of The Checkstate Property Of The Checkbox Control?

    Answer :

    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.

  10. Question 7. Differentiate Between A Textbox Control And Richtextbox Control?

    Answer :

    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.

  11. Control M Interview Questions

  12. Question 8. Describe The Tooltip Control. How Can You Associate It With Other Controls?

    Answer :

    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.

  13. Question 9. Define The Trackbar Control?

    Answer :

    The TrackBar control, also known as the slider control, works as a navigator to display a large amount of information or for visual adjustment of numeric setting. There are two parts in a TrackBar control – thumb (also known as slider) and tick marks. The thumb part acts as a slider. You can adjust the thumb part using the Value property. The tick marks are visual indicators that are spaced at regular intervals.

  14. 8051 Microcontroller Interview Questions

  15. Question 10. How Does An Mdi Form Differ From A Standard Form?

    Answer :

    An MDI form closely resembles a standard form with one major difference-the client area of an MDI form acts as a container for other forms. It means that an MDI form, also known as an MDI parent form, can display MDI child forms inside it.

  16. Question 11. Write A Method To Get Only The Name Of A File From The Complete Path String In C#?

    Answer :

    Use a FileInfo class and instantiate its object with the full path as the constructor argument and then simply call the FileInfo.Name file and you will get just the name of the file.

  17. Controller Area Network (CAN bus) Interview Questions

  18. Question 12. How Do You Retrieve The Customized Properties Of A .net Application From The Xml .config File?

    Answer :

    Initialize an instance of the AppSettingsReader class. Call the GetValue() method of the AppSettingsReader class, passing in the name of the property and the type expected. Finally, assign the result to the appropriate variable.

  19. Programmable Logic Controller (PLC) Interview Questions

  20. Question 13. What Is The Difference Between A Toolstrip Drop-down Button And A Toolstrip Split Button?

    Answer :

    The difference between a toolstrip drop-down button and a toolstrip split button is that a toolstrip split button is a combination of two controls – a push button and a drop-down button; whereas, a toolstrip drop-down button is a single control.

  21. Question 14. How Would You Create An Ellipse, Which Is A Non- Rectangular Window?

    Answer :

    Open a new Windows form, which is by default rectangular in design and then set the TransparencyKey property to the same value as BackColor, which will effectively make the background of the form transparent. Then, set the FormBorderStyle property to FormBorderStyle.None, which removes the contour and contents of the form.

  22. Question 15. What Is The Function Of The Sizemode Property Of The Picturebox Control?

    Answer :

    The SizeMode property determines how the picture will be displayed in the PictureBox control. The following five enumerations are used to set the value of the SizeMode property:

    1. Normal – Represents Standard picture box behavior (the upper-left corner of the image is placed at upper-left in the picture box)
    2. StretchImage – Displays image according the PictureBox size
    3. AutoSize – Increases or decreases the picture size automatically as per the actual size of the PictureBox control.
    4. CenterImage – Displays the image in the center if it is smaller than the PictureBox control; otherwise, the center part of the image is placed in the PictureBox control and its outside edges are clipped
    5. Zoom – Helps in stretching or shrinking the image so that it fits the PictureBox control, by maintaining the aspect ratio of the image.
  23. Control Systems Interview Questions

  24. Question 16. How Can You Prevent Users Of An Application From Editing The Text In The Combobox Controls In .net 4.0?

    Answer :

    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 ComboBoxStyle enumeration, which contains three members to define the styles for the items: Simple, DropDownList, 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;

  25. Question 17. How Can You Place A Border Around A Picture Box?

    Answer :

    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 Fixed3D, FixedSingle, or None. These properties can be easily set through code or through the Properties window of the Visual Studio IDE.

  26. Question 18. How Do We Format Numbers, Dates, And Currencies In A Text Box?

    Answer :

    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.

  27. DCS(distributed control system) Interview Questions

  28. Question 19. What Is The Use Of The Panel Control? Does It Display At Runtime?

    Answer :

    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.

  29. Question 20. What Is The Use Of A Toolstrip Container?

    Answer :

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

  30. Question 21. What Is The Importance Of A Button Control?

    Answer :

    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.

  31. Question 22. What Is The Use Of A Timer Control? Can A Timer Control Pause?

    Answer :

    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.

  32. Question 23. What Is Die Difference Between A Checkbox Control And A Radiobutton Control?

    Answer :

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

  33. Question 24. What Is The Difference Between A Menustrip Control And A Contextmenustrip Control?

    Answer :

    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.

  34. Control M Interview Questions

  35. Question 25. What Are The Values That Can Be Assigned To The Dialogresult Property Of A Button Control?

    Answer :

    The DialogResult property of a Button control can be assigned a value from the DialogResult 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
  36. Question 26. Why Do You Require User-defined Controls?

    Answer :

    User-defined controls are particularly useful in situations where you need to enhance the functionality of an existing control.

  37. Question 27. Is It Possible To Enter More Than One Line In A Textbox Control?

    Answer :

    Yes, it is possible to enter more than one line in a TextBox control. To do this, you need to set the Multiline property 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;

  38. 8051 Microcontroller Interview Questions

  39. Question 28. How Can You Enable A Text Box To Change Its Characters Format, So That Users Can Enter Password?

    Answer :

    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 = ‘*’;

  40. Question 29. What Does The Tick Frequency Property Of The Trackbar Control Do?

    Answer :

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

  41. Question 30. What Is The Difference Between The Panel And Groupbox Control?

    Answer :

    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
  42. Question 31. What Is The Difference Between A Listbox Control And A Combobox Control?

    Answer :

    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.

  43. Question 32. What Is The Maskedtextbox Control? What Does The Mask Property Do?

    Answer :

    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.

  44. Question 33. How Can You Adjust The Height Of A Combo Box Drop-down List?

    Answer :

    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.

  45. Controller Area Network (CAN bus) Interview Questions

  46. Question 34. How Can You Enforce A Text Box To Display Characters In Uppercase?

    Answer :

    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;

  47. Question 35. How Can We Disable The Context Menu For A Textbox Control?

    Answer :

    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.

  48. Question 36. What Is Use Of The Dropdownstyle Property Of The Combobox Control?

    Answer :

    The DropDownStyle property changes the style of the ComboBox control. It consists of Simple, DropDown, and DropDownList as its values. When you select Simple, the list of items are displayed as a ListBox control. 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.

  49. Control Systems Interview Questions

  50. Question 37. What Is The Difference Between Pixels, Points, And Em’s When Fonts Are Displayed?

    Answer :

    A 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.