DotNetWebTutor.com                                                    Link to Us

Developing in .Net
Visual Basic is the language
Visual Studio is the tool

Visual Basic Language
Visual Basic 2005 and C# 2005 are identical in their ability to produce high quality applications

Biggest difference is syntax

C# 2005 was designed for C and C++ programmers
VB 2005 was designed for existing VB programmers

VB compiler creates IL Intermediate Language code
C# compiler creates IL Intermediate Language code

This is how .net can accommodate multiple languages

Any code written to run in the CLR is called managed code

At runtime the CLR compiles the IL code on the fly using JIT Just in time compiler

Only converts code needed to run

Visual Basic is now a full object-oriented language
It can do anything C# can do

Earlier versions of Visual Basic were not as good as C++ and other languages. For this reason some people still underestimate its ability.

Differences:
C# provides the ability to write unsafe code
Unsafe code uses pointers to manage and access memory directly.
Is not recommended because memory cannot be removed by garbage collection
Can cause memory leaks
VB provides late binding
Allows you to create a variable as a type of Object and later assign it to a variable by assigning it to an object instance or using createObject function
Common Type System
Common Type System
In order for .Net to support all programming languages the data types must all be the same

2 categories of types

  1. value types
    1. always has a value
    2. very efficient
    3. take up little memory
    4. the actual value of the variable is passed
      1. integer
      2. boolean
      3. float
  2. reference types
    1. can be null
    2. when you pass a reference type, a copy is made of the reference to the object

types of windows applications
2 project types for Windows applications

  1. Windows Applications
    1. Creates a stand-alone EXE application
  2. Windows Control Library
    1. Creates a DLL that you can use in other EXE applications

When you build a form in the IDE, Visual Studio generates the same code that you would have to write by hand
When you add a form to a windows application, Visual Studio creates a customized form class

A form and its controls are always created and configured through code, even when you design it with the IDE

Do Not try to edit this code that Visual Studio creates for you.

To prevent this VB uses partial classes
Partial classes allow you to split a class definition into more than one file
When compiled they are all assembled into one class

VS separates the code into two parts

  1. The code part you write
  2. The code VS generates to build the form and add the controls at design time

It adds two files

  1. Test.vb- with your code
  2. Test.Designer.vb-with the automatically generated code

To view this you must show hidden files

Project | Show All Files
Then click the plus sign next to your form

Look in here to see how it works but do not change this code

Do not add code, even comments

end develop .net