Using a COM Component in a NETBased Application

In this exercise, you will create a reference to a COM object, view the Interop assembly by using ILDASM, and invoke the COM component from a Windows Forms application. The sales staff of Northwind Traders has put in a request that the Purchase Order application be able to display the number of units in inventory for a specified product. Without knowing how much inventory is available, it is difficult for the sales staff to estimate the time it will take to deliver the order. By knowing the...

Creating Printed Output by Using GDI

In this exercise, you will create pens, brushes, and fonts and then use them to draw 2-D vector objects and text at specific locations on a print document. This exercise provides you with an opportunity to assess your ability to complete the construction of a print document by using GDI+. There are starter and solution files associated with this exercise. Browse to install_folder Labfiles Lab06_1 Ex02 Starter to find the starter files, and browse to install_folder Labfiles Lab06_1 Ex02 Solution...

Lesson Printing from a Windows Forms Application

How Printing Works in a .NET Windows Forms Application PrintPage Event and PrintPageEventArgs How to Enable Printing in a Windows Forms Application Practice Adding Print Support to a Windows Forms Application for non_trainer use ****************************** Introduction This lesson describes how to add basic print support to a Windows Forms application. Most applications developed for Windows include the ability to print some information. Visual Studio .NET provides components that simplify...

Creating a New Windows Form

In this exercise, you will update the Internal Business Application shell by adding a logon form and populating it with controls. You will also set form and control properties and implement the Click event handlers for the buttons on the logon form. There are starter and solution files associated with this exercise. Browse to install_folder Labfiles Lab01_1 Ex01 Starter to find the starter files, and browse to install_folder Labfiles Lab01_1 Ex01 Solution to find the solution files. If you...

Creating and Using Controls

In this exercise, you will begin by opening an existing Windows Forms application. You will add a ToolBar control to the main form of the application, add the appropriate number of buttons to the ToolBar control, and set values for each of the buttons. After the design for the toolbar is complete, you will develop the code that handles the ButtonClick event of the toolbar and responds appropriately for each of the different buttons. You will then develop the code statements required to create...

Demonstration Expense Report Application

In this demonstration, you will see how to use the Expense Report application for non_trainer use In this demonstration, you will see how to use the Expense Report application. Note If you performed a default installation of the course files, install_folder corresponds to C Program Files Msdntrain 2565. 1. Open the InternalBusinessApp.sln solution file from the install_folder Sampapps Business Application Shell. 2. Mention that the business expense reporting application consists of two major...

How to Teach This Module

This section contains information that will help you to teach this module. If students are interested in referencing code examples in other languages, point them to Language Equivalents in the Microsoft Visual Studio .NET Help documentation. This section provides examples in languages such as Microsoft Visual Basic .NET, C , and Java. The lab at the end of this module is based on the Expense Report application in Course 2565A, Developing Microsoft .NET Applications for Windows Visual Basic .NET...

Practice Adding Adonet Objects to and Configuring Adonet Objects in a Windows Forms Application

Add and configure a SQLConnection object on a Windows Form Add and configure a SQLDataAdapter control on a Windows Form Begin reviewing the objectives for this practice activity In this practice, you will add ADO.NET objects to and configure ADO.NET objects on a form by using Data Adapter Configuration Wizard. Create a Windows application project 2. On the File menu, point to New, and then click Project. 3. In the New Project dialog box, select Windows Application, name it BuildingDataSets,...

Deploying a NET Application

In this exercise, you will package the Expense Reporting application into a Windows Installer file by using a Setup and Deployment project. You will then install the application on the local computer. Note The Internal Business Application component of the Expense Reporting application requires that the Expense Report XML Web service be installed on the target computer. This exercise assumes that the Expense Report XML Web service has already been installed on the target computer. There are...

How to Protect State and Data in a Multithreaded Environment

Interlocked.Increment and Interlocked.Decrement Design applications to try to minimize synchronization needs For many Windows Forms applications, little state protection code may be necessary, because most access of object state happens on the main thread. However, this will not be the case for every application. The System.Threading namespace provides classes and interfaces for synchronizing access to data to provide thread safety. You can use the SynchronizationAttribute on any class that is...

Adonet Objects

ADO.NET evolved from the ADO data access model. By using ADO.NET, you can develop applications that are robust and scalable and that can use XML. ADO.NET has some of the same objects as ADO like the Connection and Command objects , and introduces new objects, such as Dataset, DataReader, and DataAdapter. To move data between a data store and your application, you must first have a connection to the data store. In ADO.NET you can create and manage a connection by using a Connection object....

Demonstration Tracing the Assembly Loading Process

In this demonstration, you will see how to use the Fusion Log Viewer FUSLOGVW to trace the assembly loading process and solve probing errors In this demonstration, you will see how to use the Fusion Log Viewer FUSLOGVW to trace the assembly loading process and identify assembly loading problems probing errors . Important Prior to performing this demonstration, run the Fusion Log Viewer and enable the Log Failures checkbox. If you do not do so, the run time will not log probing errors and the...

How to Create Generic Principal and Generic Identity Objects

Create and initialize a GenericIdentity object Dim MyIdentity As New GenericIdentity User1 Create and initialize a GenericPrincipal object and attach it to the current thread Dim MyStringArray 2 As String MyStringArray O Manager MyStringArray l Employee Dim MyPrincipal As New GenericPrincipa1 MyIdentity, _ Implementing role-based security by using GenericIdentity and GenericPrincipal objects You can use the GenericIdentity class in conjunction with the GenericPrincipal class to implement...

Practice Creating and Using a Windows Installer Deployment Project

In this practice, you will create and test a Windows Installer deployment project for the WindowsCalculator application Begin reviewing the objectives for this practice activity In this practice, you will create a Microsoft Installer setup project and add the WindowsCalculator application to the project. You will then test the project to validate that the application installed and works correctly. 2. On the Start page, click New Project. 3. In the New Project window, in the Project Type pane,...

Dock controls on a form

In this demonstration, you will see how to organize controls on a form. Organize controls by using the Format menu 1. Open the WorkingWithControls project in Visual Studio .NET from installfolder Democode Mod01 Mod01_01 Starter. 2. If the WorkingWithControls.vb form is not visible, display it in Design view. You will notice that the controls on the forms are not organized very well. 3. Organize the buttons on the form so that the Display button is positioned to the left of the Exit button. 4....

Calling Win32 APIs from a NETBased Application

In this exercise, you create a class that exposes a Win32 API. You will then invoke the Win32 API by using your class from a Windows Forms application. The PlaySound function takes three arguments and returns a Boolean value that indicates whether or not the function was able to play the sound file. The arguments include A string that defines the name of the sound file. Hmod Handle to the executable file that contains the resource to be loaded. This parameter must be NULL unless SND_RESOURCE is...

Using an Application Configuration File

In this exercise, you will create an application configuration file that will redirect the Internal Business Application to load a new version of the ExpenseReport.dll file. There are starter and solution files associated with this exercise. Browse to installfolder Labfiles Lab09_1 Ex04 Starter to find the starter files, and browse to install_folder Labfiles Lab09_1 Ex04 Solution to find the solution files. If you performed a default installation of the course files, installfolder corresponds...

Defining an Event and Raising It from an Extended Control

In this exercise, you will define an event for the NumericTextBox control, raise it from the control, pass event information, and respond to it from a host application. There are starter and solution files associated with this exercise. Browse to install_folder Labfiles Lab03_1 Ex01 Starter to find the starter files, and browse to install_ older Labfiles Lab03_1 Ex01 Solution to find the solution files. If you performed a default installation of the course files, install older corresponds to C...

Lesson Licensing a Control

How to Enable Licensing for a Control Demonstration Creating and Validating a License for a Control How LicFileLicenseProvider Works in .NET illegal for non-trainer use Introduction The .NET Framework provides a licensing model that is identical for all components including Windows Forms controls and ASP.NET server controls, although the implementation is different. Licensing allows control authors to protect their property by checking that a user is authorized to use the control. This check...

Inheriting a New Form from an Existing Windows Form

In this exercise, you will update the Internal Business Application shell by adding an About dialog by inheriting from a generic Windows Form. There are starter and solution files associated with this exercise. Browse to installfolder Labfiles Lab01_1 Ex02 Starter to find the starter files, and browse to install_folder Labfiles Lab01_1 Ex02 Solution to find the solution files. If you performed a default installation of the course files, installfolder corresponds to C Program Files Msdntrain...

Call the Layout Mdi method

Procedure Listing the child windows of a parent form In an MDI application, a parent form has several child forms, and each of the child forms interacts with the parent form. Visual Studio .NET includes several properties that allow parent and child forms in an MDI application to interact. An easy way to keep track of the different MDI child windows an application has open is to use a Window list. The functionality to keep track of all the open MDI child forms as well as which child form has...

Begin reviewing the objectives for 15 this practice activity

In this practice, you will install the CalculatorEngine assembly in the global assembly cache. You will then build the WindowsCalculator application. Prior to running the application, you will remove all the local copies of CalculatorEngine.dll. You will then verify that WindowsCalculator still runs because it finds the correct version of CalculatorEngine in the global assembly cache. Important During development, you can use the Global Assembly Cache tool GACUtil to install your assembly in...