YouTube Icon

Interview Questions.

Top 37 Windows Controls Interview Questions - Jul 28, 2022

fluid

Top 37 Windows Controls Interview Questions

Q1. 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 elegance to True to permit it to accept passwords. The code to change the PasswordChar assets of the TextBox elegance is given as follows:

textBox1.PasswordChar = '*';

Q2. What Is The Maskedtextbox Control? What Does The Mask Property Do?

The MaskedTextBox manage is an improvement of the TextBox manage. It forces the person to provide the right input, that's distinct with the aid of the Mask belongings. In other words, it prevents the person to provide any invalid input to an utility. The Mask property gets or sets the enter kind to the MaskedTextBox manage. There are many integrated formats for the Mask belongings, such as smartphone no., short date, time, zip code, and custom.

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

Open a new Windows shape, which is through default square in design after which set the TransparencyKey belongings to the equal price as BackColor, with the intention to successfully make the heritage of the form transparent. Then, set the FormBorderStyle belongings to FormBorderStyle.None, which removes the contour and contents of the shape.

Q4. What Is Use Of The Dropdownstyle Property Of The Combobox Control?

The DropDownStyle assets changes the fashion of the ComboBox manage. It includes Simple, DropDown, and DropDownList as its values. When you pick Simple, the listing of items are displayed as a ListBox manipulate. When you select DropDown, the list is displayed in a drop down fashion. When you pick DropDownList, the listing displayed in a drop down fashion and you cannot edit its text.

Q5. Define The Trackbar Control?

The TrackBar manipulate, also known as the slider manage, works as a navigator to show a massive amount of records or for visual adjustment of numeric setting. There are  parts in a TrackBar manipulate - thumb (also called slider) and tick marks. The thumb part acts as a slider. You can adjust the thumb element using the Value belongings. The tick marks are visual signs that are spaced at normal periods.

Q6. What Is The Use Of A Toolstrip Container?

A toolstrip field is used to comprise controls, including ToolStrip, MenuStrip, and StatusStrip, so that these controls may be docked and moved at the run time.

Q7. How Can We Disable The Context Menu For A Textbox Control?

The TextBox magnificence includes the ContextMenuStrip assets. When we set this property to a dummy instance of the ContextMenu class, the TextBox manage is unable to offer any context menu at the proper-click on of the mouse.

Q8. How Do We Format Numbers, Dates, And Currencies In A Text Box?

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

Q9. What Is The Use Of The Panel Control? Does It Display At Runtime?

Panels acts as a container to group different controls. It is an crucial manage, when you want to expose/cover a group of controls and relocate a number of controls concurrently.

When you generate a new manage at runtime, it works as a field control. As we understand, it's far a box manage; therefore, it isn't always displayed at runtime.

Q10. Why Do You Require User-described Controls?

User-defined controls are in particular useful in situations in which you need to decorate the capability of an current control.

Q11. What Is The Importance Of A Button Control?

A Button manipulate is an essential Windows manage, which presents the maximum common way of making and managing an event in the code with the help of its Click occasion.

Q12. How Can You Prevent Users Of An Application From Editing The Text In The Combobox Controls In .Net four.Zero?

The ComboBox elegance contains the DropDownStyle belongings, that's used to define the show style of the gadgets within the ComboBox manage. The DropDownStyle belongings accepts a value from the ComboBoxStyle enumeration, which incorporates 3 members to define the styles for the items: Simple, DropDownList, and DropDown. The DropDownList price of the ComboBoxStyle enumeration is selected to set a ComboBox manage as non-editable by way of customers, as shown inside the following code snippets:

Code for VB:

ComboBox1.DropDownStyle = ComboBoxStyle.DropDownList

Code for C#:

ComboBox1.DropDownStyle = ComboBoxStyle.DropDownList;

Q13. What Does The Tick Frequency Property Of The Trackbar Control Do?

The Tick Frequency assets gets or units a value that specifies the gap among ticks. By default, the distance between ticks is 1.

Q14. How Does An Mdi Form Differ From A Standard Form?

An MDI shape carefully resembles a fashionable form with one fundamental difference-the customer region of an MDI shape acts as a container for other forms. It approach that an MDI shape, also known as an MDI discern form, can show MDI baby forms interior it.

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

The Button magnificence includes the Image belongings, that's used to set an image on the Button manage. We also can set the alignment of the picture by way of using the Image Align assets of the Button magnificence.

Q16. How Can You Place A Border Around A Picture Box?

The PictureBox manage gives the BorderStyle property, which may be set to outline the style of its border. This belongings can be given any of the three values from Fixed3D, FixedSingle, or None. These homes can be without difficulty set through code or via the Properties window of the Visual Studio IDE.

Q17. What Is The Difference Between A Menustrip Control And A Contextmenustrip Control?

The distinction among a MenuStrip manage and a ContextMenuStrip manage is that a MenuStrip manipulate is associated with the Windows Form; while, a ContextMenuStrip manage is related to a manage, that is delivered to the Windows Form.

Q18. Is It Possible To Enter More Than One Line In A Textbox Control?

Yes, it's far feasible to enter multiple line in a TextBox control. To try this, you want to set the Multiline property of the TextBox manage to True. You can set this belongings at layout time as well as runtime.

The syntax to set this property at runtime is as follows:

Textbox1.Multiline = authentic;

Q19. How Can You Enforce A Text Box To Display Characters In Uppercase?

The TextBox elegance consists of the CharacterCasing belongings, that is used to specify the case of the content material for a textual content box. This belongings accepts a fee from the CharacterCasing enumeration of .NET Framework. The individuals specified within the CharacterCasing enumeration are Lower, Upper, and Normal. You can pick out anybody of these enumerations as a price for the CharacterCasing assets of a exact textual content field, as shown in the following code snippet:

textBox1.CharacterCasing = CharacterCasing.Upper;

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

The Button manipulate has the AutoSize assets, which may be set to real or fake. If we set the cost of the AutoSize assets to actual, then the button manage robotically alters its size in step with the content displayed on it.

Q21. How Is Anchoring Different From Docking?

Docking refers to attaching a control to both an part (pinnacle, proper, bottom, or left) or the client vicinity of the determine control. On the other hand, anchoring is a procedure in which you want to specify the gap that every edge of your control continues from the rims of the determine manage.

Q22. Differentiate Between A Textbox Control And Richtextbox Control?

The TextBox manage is an input control, which permits a user to go into textual content to an software at runtime. By default, it permits only unmarried line text; however, you can exchange its assets to accept the multiline textual content in addition to scroll bar additionally.

The RichTextBox manage is much like the TextBox manage with the distinction that it permits the user to format its textual content additionally. You can layout the text in numerous methods, including formidable, italic, and underlined in addition to change its colour and font. You can shop your RichTextBox cost to a RTF (Rich Text Format) record and cargo value of RTF document to the RichTextBox control.

Q23. What Is The Difference Between The Panel And Groupbox Control?

The Panel and GroupBox controls each can be used as a box for different controls, such as radio buttons and test box. The most important differences among a Panel and a GroupBox control are as follows:

Panel does no longer show captions, at the same time as GroupBox do

Panel has scrollbar, at the same time as GroupBox does now not

Q24. What Is The Difference Between A Toolstrip Drop-down Button And A Toolstrip Split Button?

The distinction among a toolstrip drop-down button and a toolstrip cut up button is that a toolstrip break up button is a combination of  controls - a push button and a drop-down button; while, a toolstrip drop-down button is a single control.

Q25. What Is The Difference Between Pixels, Points, And Em's When Fonts Are Displayed?

A pixel is the lowest-resolution dot that the laptop screen helps. Its size depends on person's settings and the dimensions of the display. A factor is continually 1/72 of an inch. An em is the range of pixels it takes to display the letter M.

Q26. What Is The Difference Between The Windows Default Location And Windows Default Bounds Properties?

The Windows Default Location property makes the form to start up at a place decided on through the operating gadget, however with internally specific length. The Windows Default Bounds belongings delegates each length and beginning role choices to the running system.

Q27. What Is The Function Of The Checkstate Property Of The Checkbox Control?

The CheckState belongings gets or units the country of CheckBox.

If the ThreeState belongings is set to fake, the CheckState assets cost can only be set to CheckState.Indeterminate in code and no longer by user interplay.

Checked - The CheckBox shows a check mark. The manage seems sunken.

Unchecked - The CheckBox is empty. The control appears raised.

Indeterminate - The CheckBox presentations a take a look at mark and is shaded.

Q28. How Do You Retrieve The Customized Properties Of A .Internet Application From The Xml .Config File?

Initialize an example of the AppSettingsReader elegance. Call the GetValue() technique of the AppSettingsReader elegance, passing within the name of the belongings and the kind predicted. Finally, assign the end result to the right variable.

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

Use a FileInfo class and instantiate its object with the total course as the constructor argument and then honestly name the FileInfo.Name document and you will get simply the name of the file.

Q30. What Is The Use Of A Timer Control? Can A Timer Control Pause?

The Timer manipulate is a mechanism to carry out an iterative task at a targeted time interval. You can't pause it because it is able to best start and prevent.

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

The RichTextBox manipulate carries the Lines array property, which presentations one object of an array in a separate line. Each line access has a Length property,

which can be used to correctly function the cursor at a individual, as proven within the following code snippet:

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

 int offset = zero;

 for(int i = 0; i < Line -1 && i < RTB.Lines.Length; i++)

 

 offset += RTB.Lines[i].Length + 1;

 

 RTB.Focus();

 RTB.Select(offset + Column, zero);

Q32. What Is The Function Of The Sizemode Property Of The Picturebox Control?

The SizeMode belongings determines how the image will be displayed within the PictureBox control. The following five enumerations are used to set the fee of the SizeMode assets:

Normal - Represents Standard photograph box conduct (the upper-left corner of the photo is located at top-left inside the photo box)

StretchImage - Displays picture according the PictureBox size

AutoSize - Increases or decreases the picture length robotically as in line with the actual length of the PictureBox control.

CenterImage - Displays the picture in the center if it is smaller than the PictureBox control; otherwise, the center a part of the image is placed in the PictureBox manipulate and its outdoor edges are clipped

Zoom - Helps in stretching or shrinking the photo so that it fits the PictureBox manage, via preserving the thing ratio of the photograph.

Q33. Describe The Tooltip Control. How Can You Associate It With Other Controls?

The ToolTip manage generates a small pop-up window with explanatory textual content for an element It is displayed while the consumer pauses the mouse for a certain length over an detail/control. Tool hints provide a quick help to person to understand approximately that element. To companion a tool tip with different manipulate, you need to put into effect the SetToolTip() method.

Q34. What Is The Difference Between A Listbox Control And A Combobox Control?

With a ListBox control, the person can simplest make a ramification from a listing of gadgets; whereas, with a ComboBox control, the person can make a selection from the listing of gadgets in addition to can add custom entry and choose the equal.

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

You can manipulate the peak of a combo field drop-down list by setting the MaxDropDownItems property of the mix container. The MaxDropDownItems property units the maximum quantity of entries as a way to be displayed with the aid of the drop-down list.

Q36. What Is Die Difference Between A Checkbox Control And A Radiobutton Control?

A CheckBox control is rectangular formed; whereas, a RadioButton manage is round in shape. Moreover, you can choose multiple CheckBox control from a collection of CheckBox controls; while, you can choose most effective a unmarried RadioButton control from a group of RadioButton controls.

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

The DialogResult belongings of a Button control may be assigned a value from the DialogResult enumerations, that are as follows:

Abort-Returns Abort

Cancel-Returns Cancel

Ignore-Returns Ignore

No-Returns No

None-Nothing is lower back from the conversation field

OK-Returns OK

Retry-Returns Retry

Yes-Returns Yes




CFG