Winform interview question and answers

4,782 views 10 slides Nov 16, 2015
Slide 1
Slide 1 of 10
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10

About This Presentation

It is about interview questions related to window form.w3asp.net is a educational website which provide you all information about asp.net like faqs, article, quiz,jobs etc


Slide Content

www.w3asp.net Top 15 Window form Interview Questions & Answers

www.w3asp.net Ans. System.Windows.Forms.Form 1. What base class do all Winforms inherit from? 2. How is anchoring different from docking? Ans. 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.

www.w3asp.net 3. What is the difference between pixels, points and ems ? Ans. A pixel is the lowest-resolution dot the computer monitor supports. Its size depends on users settings and monitor size. A point is always 1/72 of an inch. An em is the number of pixels that it takes to display the letter M. 4. How can you assign an RGB color to a System.Drawing.Color object? Ans. Call the static method FromArgb of this class and pass it the RGB values.

www.w3asp.net 5.What is the difference between WindowsDefaultLocation and WindowsDefaultBounds ? Ans. WindowsDefaultLocation tells the form to start up at a location selected by OS, but with internally specified size. WindowsDefaultBounds delegates both size and starting position choices to the OS. 6. How can you get or set the time between Timer ticks? Ans. There is an Interval property, which is responsible to get and set the time in milliseconds.

www.w3asp.net 7. How can we auto size a button to fit its text? Ans. 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. 8. When would you use ErrorProvider control? Ans. ErrorProvider control is used in Windows Forms application. It is like Validation Control for ASP.NET pages. ErrorProvider control is used to provide validations in Windows forms and display user friendly messages to the user if the validation fails.

www.w3asp.net 9. How do I make a TextBox use all upper-case (or lower-case) characters? Ans. Use the CharacterCasing property of the TextBox.textBox1.CharacterCasing = CharacterCasing.Upper ; textBox2.CharacterCasing = CharacterCasing.Lower ; 10. Write a simple Windows Forms MessageBox statement. Ans. The code is: System.Windows.Forms.MessageBox.Show (" Hello, Windows Forms");

www.w3asp.net 11. How would you create a non-rectangular window, let’s say an ellipse? Ans. Create a rectangular form, set the TransparencyKey property to the same value as BackColor , which will effectively make the background of the form transparent. Then set the FormBorderStyle to FormBorderStyle.None , which will remove the contour and contents of the form. 12. How do you create a separator in the Menu Designer? Ans. A hyphen ‘-’ would do it. Also, an ampersand ‘&\’ would underline the next letter.

www.w3asp.net 13. My progress bar freezes up and dialog window shows blank, when an intensive background process takes over. Ans. Yes , you should’ve multi-threaded your GUI, with taskbar and main form being one thread, and the background process being the other. 14. Why is it not a good idea to insert code into InitializeComponent method when working with Visual Studio? Ans. The designer will likely throw it away; most of the code inside InitializeComponent is auto-generated.

www.w3asp.net 15. How can you save the desired properties of Windows Forms application? Ans. . config files in .NET are supported through the API to allow storing and retrieving information. They are nothing more than simple XML files, sort of like what . ini files were before for Win32 apps.

www.w3asp.net Thank You!!!