Previous Next
Programmers Guide for .NET Chapter 7 - Programming in VB.NET

Chapter 7 - Programming in VB.NET

DB Visual ARCHITECT (DB-VA) can generate C#.NET source code so you can implement your application by C# programming language directly but you also can choose another language (VB.NET or C++) based on your taste in the .NET Framework. DB-VA generates DLL files and persistent libraries that can be referenced by .NET projects of language other than C#.

In this chapter:

Introduction

Visual Basic .NET (VB.NET) is an Object-Oriented computer language that can be viewed as an evolution of Microsoft’s Visual Basic (VB) implemented on the Microsoft .NET framework. The .NET Framework contains a virtual machine called Common Intermediate Language (CIL). Simply put, programs are compiled to produce CIL and the CIL is distributed to user to run on a virtual machine. VB.NET, C++, C# compilers are available from Microsoft for creating CIL. In DB-VA you can generate C# persistent source code and DLL files, so you can reference the DLL file and Persistent Library in Visual Studio .NET 2003 and develop the VB.NET application.

In the following section, you will develop a VB.NET application. The application is exactly the same as the one in Chapter 4 – Developing Standalone .NET Application sample but this time you use VB.NET instead of C# for development. You need to download Chapter 4 sample application because it contains the DLL file and persistent libraries for your VB.NET project.

Generating DLL File

  1. From the menu bar, select Tools > Object-Relational Mapping (ORM) > Generate Database… to open the Database Code Generation dialog box.

  2. Check the Compile to DLL option to generate the DLL file.

Creating VB.NET Project

  1. Open Microsoft Visual Studio .NET 2003.
  2. Select File > New > Project … from the menu.

  3. Select the Project Types as Visual Basic Projects and Templates as Windows Application and enter the Name and Location for the new application.

  4. The School System Project is created.

Adding Referenced Project

  1. Right click References under the Standalone School System VB.NET project and select Add Reference… to add the C# example DDL file and persistent libraries.

  2. Click Browse… on the Add Reference dialog box to select the folder of the downloaded C# standalone application sample. Select C# sample folder/bin/SchoolSystem.dll and all libraries in C# sample folder/lib.

Working with the Generated Code and Persistent Library

Both the C# and VB.NET languages are built on the .NET framework. Both languages accomplish the same thing using different language syntax. In this section, we will point out some examples of using the generated code and persistent library.

Running Application

The VB.NET project is implemented in Visual Studio .NET 2003. To execute the VB.NET Application, select Debug > Start (F5) from the menu bar.


Previous Next
Visual Paradigm International Limited
Website: www.visual-paradigm.com
E-mail: support@visual-paradigm.com