Windows Forms Interview Questions & Answers

  1. Question 1. Suppose I Am Implementing One Windows Form. I Am Inserting Some Values Into Ms Access. In That Table 5 Columns There. But I Want To Insert Three Columns Only. When I Am Clicking Another Button Then Other Two Values Also Insert Into That Table?

    Answer :

    First time insert five columns but two columns are empty  Value that’s null value when we click another button update  Query is used insert remaining columns (where condition Filled columns value).

  2. Question 2. Suppose I Have Two Combo Box .. And I Have Some Items In Both Combo Box Now I Need To Check The Item In Both Combo Box If Same Item Is Present In Both Combo Box I Need To Display That Item In Message Box?

    Answer :

    For inti As Integer = 0 To ComboBox1.Items.Count 

    For intj As Integer = 0 To ComboBox2.Items.Count 

    If ComboBox1.Items (inti).ToString = ComboBox2.Items (intj).ToString Then MessageBox.Show (ComboBox1.Items(inti))

    End If

    Next

    Next

  3. XML Interview Questions

  4. Question 3. How To Create A Set Up In Vb.net For Desktop Application Please Say Steps With Examples?

    Answer :

    1. Goto file.
    2. Add your project by right click the project that u newly Created (In Solution Explorer).
    3. Add Project output and localized resources by right Clicking the existing project in solution explorer.
    4. Finally build the project (Or) Take a Setup project from Visual Studio Deployment. Projects. By default you will get. 

    File System on Target Machine.

    Different Editors in Setup project:

    1. File System on Target Machine.
    2. Registry on Target Machine
    3. File Types
    4. User Interface
    5. Custom Actions
    6. 6. Launch Conditions
  5. Question 4. Explain Something About Crystal Report In Brief?

    Answer :

    Crystal Reports provides broad data connectivity options  making it easy to access enterprise data and satisfy end user information requirements.

    If u want to use your own SQL commands use the query generation in Crystal Reports.

  6. XML Tutorial

  7. Question 5. Write A Program To Create Login Form?

    Answer :

    The following example demonstrates how to use a Login Control to provide a user interface to log on to a Web site With sql server database.

    VB : Imports System. Data , Imports System.Data.SqlClient and Imports System.Web.Configuration , C# : using System. Data; , using  System.Data.SqlClient; and using System.Web.Configuration;

    1. xml file or web. Config

    provider Name=”System.Data.SqlClient”/>

    2. how-to-login-with-sql-server-c.aspx (Design Page)

    <%@ Page Language="C#" AutoEventWireup="true" Code File="how-

    to-login-with-sql-server-c.aspx.cs” 

    Inherits=”how_to_login_with_sql_server_c” %>

    Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-

    transitional.dtd”>

    how to login with sql server database:

    Back Color=”#FFFBD6″ Border Color=”#FFDFAD” Border Padding=”4″

    Border Style=”Solid” Border Width=”1px” Font-

    Names=”Verdana” Font-Size=”0.8em”

    Fore Color=”#333333″ 

    On Authenticate=”Login1_Authenticate” TestLayout=”TextOnTop”

    Width=”293px” 

    Height=”172px”>

    Bold=”True” Font-Size=”0.9em” 

    Fore Color=”White” />

    Fore Color=”Black” />

    Border Color=”#CC9966″ Border Style=”Solid” Border Width=”1px”

    Font-Names=”Verdana” Font-Size=”0.8em” 

    Fore Color=”#990000″ />

    3. how-to-login-with-sql-server-c.aspx.cs (Code Behind 

    C# Language) 

    using System;

    using System.Collections;

    using System. Configuration;

    using System. Data;

    using System.Linq;

    using System. Web;

    using System.Web.Security;

    using System.Web.UI;

    using System.Web.UI.HtmlControls;

    using System.Web.UI.WebControls;

    using System.Web.UI.WebControls.WebParts;

    using System.Xml.Linq;

    using System. Data;

    using System.Data.SqlClient;

    using System.Web.Configuration;

    public partial class how_to_login_with_sql_server_c : 

    System.Web.UI. Page

    {

    protected void Login1_Authenticate(object sender, 

    AuthenticateEventArgs e)

    {

    string username = Login1.UserName;

    string pwd = Login1.Password;

    string str Conn;

    str Conn = WebConfigurationManager.ConnectionStrings

    [“ConnectionASPX”].Connection String;

    SqlConnection Conn = new SqlConnection(strConn);

    Conn. Open ();

    String sqlUserName;

    SqlUserName = “SELECT Username, Password FROM 

    Username “;

    SqlUserName += ” WHERE (Username ='” + username 

    + “‘)”;

    SqlUserName += ” AND (Password ='” + pwd + “‘)”;

    SqlCommand com = new SqlCommand (sqlUserName, Conn);

    String Current Name;

    Current Name = (string) com.ExecuteScalar ();

    if (Current Name != null)

    {

    Session[“User Authentication”] = username;

    Session. Timeout = 1;

    Response.Redirect(“how-to-StartPage.aspx”);

    }

    else

    {

    Session[“User Authentication”] = “”;

    }

    }

    }

  8. Windows Administration Interview Questions

  9. Question 6. Explain How To Add Resources During Runtime?

    Answer :

    Call the GetLocalResourceObject or GetLocalResourceObject method to read specific resources from a global or local resource file.

    The GetLocalResourceObject method takes the name of a resource class and the resource ID. The class name is based on the .resx file name. For example, the file. WebResources.resx, and all associated localized files, are referenced by the class name Web Resources.

    The GetLocalResourceObject method takes a resource name representing a Resource Key property.

    Button1.Text = GetLocalResourceObject(“Button1.Text”).ToString(); 

    Button2.Text = (String)GetLocalResourceObject(

    “WebResourcesGlobal”, “Button2.Text”);

    A local default resource file stored in the special App_LocalResources folder is named according to the ASP.NET page. For example, if the following code is used in a Default.aspx page, the resource file must be named Default.aspx.resx. For this example, add a string resource to this file named Button1.Text with the value “Found Resources”.

    A global default resource file that is stored in the special App_LocalResources folder is named WebResourcesGlobal.resx. Add a string resource named LogoUrl with the value “Found Resources”.

  10. Question 7. Explain How To Net Forms The Windows?

    Answer :

    Windows Forms: is the name given to the graphical application programming interface (API) included as a part of Microsoft .NET Framework, providing access to native Microsoft Windows interface elements by wrapping the extant Windows API in managed code.

  11. LINQ Tutorial
    Java-Multithreading Interview Questions

  12. Question 8. Where To Use New Keyword Other Than Create Instance?

    Answer :

    Hiding of base class method (non abstract method) can be done just by giving an implementation in the derived class. The “new” keyword is not necessary. You can add the “new” keyword to prevent a warning message during compilation.

  13. Question 9. How To Split A Column Header In Gridview Using C#.net?

    Answer :

    This can be done at client side, if u have a fixed format by, creating a html table format in grid’s “header template” and in item template.

  14. SCCM Interview Questions

  15. Question 10. How To Find The Current Record Position In Data Control?

    Answer :

    Absolute Position.

  16. Windows Presentation Foundation(WPF) Tutorial

  17. Question 11. How Many Number Of Events Does The Timer Controls?

    Answer :

    2 events, one is disposed , second one is tick event.

  18. OOPS Interview Questions

  19. Question 12. Which Property Is Used To Lock A Text Box To Enter Data?

    Answer :

    Textbox. Enabled = True;

    This property is used to lock the text box to enter data.

  20. XML Interview Questions

  21. Question 13. What Is The Need Of Z-order Method?

    Answer :

    1. Z order method is the use of the show the design of the output form to use z order technique.
    2. z order technique is Show view of the Z corner to print the z style.
    3. Z order is Access the data in the two dimension Array to access data

    Ex:

    1234

    5678

    9065

    call Z order method to pass order.

    For ex: pass 3 then output is 1396 to Access four corner of the z order.

  22. MVVM Tutorial

  23. Question 14. What Is The Difference Between List Index And Tab Index?

    Answer :

    List index : This property is used to check the index value of the items in the List box. 

    Tab index : This property is used to set the flow of controls in the form when we press the tab button.

  24. Question 15. Which Property Of Menu Cannot Be Set At Run Time?

    Answer :

    Item property cannot be set at runtime.

  25. LINQ Interview Questions

  26. Question 16. What Is The Difference Between List Box And Combo Box?

    Answer :

    • In List Box we have to choose one of the option from the drop down list. 
    • In Combo just like radio button we have to choose any one.
  27. Windows Communication Foundation (WCF) Tutorial

  28. Question 17. What Are The New Events In Text Box That Has Been Included In Vb?

    Answer :

    validate event to control.

  29. Dot Net Remoting Interview Questions

  30. Question 18. How Insert Record In The Database?

    Answer :

    insert into values (Parm1,parm2….).

  31. Windows Administration Interview Questions

  32. Question 19. How Save Rerecord In The Database?

    Answer :

    Dim Query

    Query=”insert into Table_name(username)values(‘” & txt_username.text & “‘)”.

    Dim cmd as sqlclient.sqlcommand=new sqlclient.sqlcommand(Query, connection) cmd.ExecuteNonquery().

  33. Question 20. How Bar Code Create In The Report?

    Answer :

    1. Take a barcode font like we used Arial, Time new Roman.
    2. Install this font at window fonts directory.
    3. Use Steric (*) at both ends of a field of Report with the help of double/single commas. 
    4. Change this field Font Like from Time new roman to barcode font.

    E.g Bar is field that contain digit from 1 to 8 as shown below:

    *12345678*

    After changing font these digit were converted into Black 

    Lines mean barcode

    |||||||||||||||

    5-Take print of barcode and enjoy.

  34. DataGrid Interview Questions

  35. Question 21. How To Get Records From A Database?

    Answer :

    You have to get the “dot net driver” of the database (or any other DataSource) you want to access to.

    For example:

    Mysql: Connector/Net

    Access: Microsoft Access Driver

    Oracle: Oracle Data Access Components (ODAC)

    Afterwards you build a connection string to tell your Program which driver you want to use and where the dataSource can be found.

    for example:

    Public const string DB_CONN_STRING = “Driver={Microsoft Access Driver (*.mdb)}; “+  “DBQ=D: CSTestDbReadWriteSimpleTest.mdb”;

    Afterwards you just have to open a connection to the database using the previously created connection string and send a query to the database to get the record:

    ADO Connection conn = new ADO Connection (DB_CONN_STRING); 

    Conn. Open (); 

    ADODataReader dr;

    ADO Command cmd = new ADO Command ( “SELECT * FROM

    “, Conn);

    Cmd. Execute (out dr); 

    while (dr.Read()){

    ….}