C#: Introduction to Forms

Author: Ronald S. Holland
at
Total Application Works




To contact us



HOME] Consulting Design Maintenance Project Testing Training Turnkey Java C++ SQL HTML JavaScript C#

© 2002 - 2013 All Rights Reserved Total Application Works


    Tell a friend about this site (copy and paste the following HTML page into a file (e.g., using Notepad).)
    <html>
    <head>
    <title>C#: Table of Contents </title>
    </head>
    <body>
    <a href="http://sumtotalz.com/TotalAppsWorks/CSharp/CS_Forms.html">
    </a>
    </table>
    </body>
    </html>


Table of Contents

  1. Introduction to C#
  2. Control Statement: Selection Statement in C#
  3. Control Statements: Loops Statement
  4. Methods
  5. Namespaces
  6. Introduction to Classes:
  7. Inheritance:<
  8. Polymorphism
  9. Properties
  10. Indexers
  11. Structs
  12. Interfaces
  13. Delegates:
  14. Exception Handling:
  15. Attributes
  16. Enums
  17. Encapsulation
  18. Parameter Passing in C#
  19. Method Overloading
  20. Database Interaction Using C#
  21. Operator Overloading in C# -1
  22. Operator Overloading in C# -2
  23. Operator Overloading in C# -2
  24. Sockets
  25. DNS [Domain Name System]
  26. Working with Files
  27. Generating Help File in C#
  28. Code Access Security
  29. Multi-Threading
  30. Globalization and Localization -1
  31. Working with Registry in C#
  32. Globalization and Localization -2
  33. Windows Service
  34. Web Service
  35. Consuming Web Services
  36. Creating Proxy Object of Web Service
  37. Creating an XML document
  38. Reading XML document in C#
  39. Using XMLWriter class to Write XML document in C#
  40. Assembly Information : Getting Permission set of the assembly
  41. Creating your own Permission Set
  42. Using C# Socket

Outline

  • In this tutorial, we will explore the following concepts:
    • Building the Hello Windows Forms Application
    • Explaining, creating and Using an event handler
    • Defining the border style of the form
    • Adding a menu
    • Adding a menu shortcut
    • Handling events from menus

    Introduction

    The purpose of this tutorial is to introduce you to the basics of C# ("C sharp") forms. Even if you've never programmed in a language similar to C/C++ or Java before, this tutorial should be very easy to follow and understand. It assumes that you have some basic exposure to programming (some object-oriented experience would be helpful, but is not necessary) and you have some kind of C# compiler (if you would like to run the examples). First, you should know that C# is a language designed by Microsoft. It is intended to combine the most significant parts of C/C++ along with the productivity of a 4GL, such as Visual Basic.

    What is the origin of Windows Forms?

    Windows Forms is the .NET replacement for MFC. Unlike the MFC library, which was a thin wrapper on the Win32 API, Windows Forms is a totally object-oriented, hierarchical based for Windows development under .NET . Similar to Java's Abstract Window Toolkit (AWT), Windows Forms was an early and easy way to provide graphical user interface components to the .NET Framework. Windows Forms (WinForms) is the name given to the graphical application programming interface (API) included as a part of Microsoft .NET Framework,

    You should have read and mastered:
    1. Introduction to C#
    2. First C# Program

    Instructions on how to obtain one will be described in the next section, if you do not have a C# compiler.

    Free Compilers

    If you don't have a c# compiler, you can download a free copy at Microsoft's Visual Studio Downloads Page. This download may take approximately 24 hours using a 56 kbps dial-up. You may be able to download a copy in 5-10 minutes, if you have access to a T1 line at a public college or a public library, assuming a line is available. You may be able to download a copy in 15-20 minutes, if you have access to a broadband internet provider. You can follow the steps below:

    1. Download a free copy of VC++ at Microsoft's Visual Studio Downloads Page.
      • This copy is in image file format (ISO images).
      • I used this option: All - Offline Install ISO image file. With this option, you get the following:
        • Visual Basic 2010 Express Edition
        • Visual C# 2010 Express Edition
        • Visual C++ 2010 Express Edition
        • Visual Web Developer 2010 Express Edition
    2. Download a free copy of VCdControlTool. It only works with ISO images. Installation instructions:
      1. Copy VCdRom.sys to your WINDOWS\system32\drivers folder.
      2. Execute VCdControlTool.exe
      3. Click "Driver control"
      4. If the "Install Driver" button is available, click it. Navigate to the WINDOWS\system32\drivers folder, select VCdRom.sys, and click Open.
      5. Click "Start"
      6. Click OK
      7. Click "Add Drive" to add a drive to the drive list. Ensure that the drive added is not a local drive. If it is, continue to click "Add Drive" until an unused drive letter is available.
      8. Select an unused drive letter from the drive list and click "Mount".
      9. Navigate to the image file (VS2010ExpressWithSP1ENUX1504728.iso or VS2010Express1.iso), select it, and click "OK". UNC naming conventions should not be used; however, mapped network drives should be OK.
    3. Next use Windows Explorer to navigate to the Virtual drive you mounted. You will see the following folders:
      • Include
      • VBExpress
      • VCExpress
      • VCSExpress
      • VWDExpress
    4. Use the setup application in each folder to install the desired components.
    5. You are ready to start programming.
    6. You can download other compilers at:
    Next, we present a brief introduction to c# forms in the next section.

    How to: Create a New Windows Forms Application Project

    The foundation of most solutions that involve Windows Forms is the Windows Forms Application project. Creating a project is easy within the integrated development environment (IDE).

    To create a Windows Forms Application project

    1. Start Visual Studio 2012.

    2. On the File menu, point to New, and then select Project.

      The New Project dialog box appears.

    3. In the Installed Templates pane, expand Visual C#, and then select Window Forms Application.

    4. Above the middle pane, select the target framework from the drop-down list.

    5. In the middle pane, select the Windows Forms Application template.

      The Windows Forms Application template in the .NET Framework 4 targets the Client Profile by default.

    6. In the Name text box, specify a name for the project.

    7. In the Location text box, specify a folder to save the project.

    8. Click OK.

      The Windows Forms Designer opens and displays Form1 of the project.

    9. Click on the Toolbox tab, which is located on the right side of the Visual Studio IDE.
      • Expand All Windows Forms, where you view all the controls you can use in your application.
      • You can use the following controls:
        • Button
        • Textbox
        to build






  • HOME] Consulting Design Maintenance Project Testing Training Turnkey Java C++ SQL HTML JavaScript C#


    © 2002 - 2013 All Rights Reserved Total Application Works