Click here to Skip to main content
15,352,679 members
Articles / Programming Languages / C#
Posted 18 Aug 2004


39 bookmarked

Some new features in Visual Studio.NET 2005

Rate me:
Please Sign up or sign in to vote.
4.22/5 (22 votes)
22 Aug 20046 min read
An article on the new features in Visual Studio.NET 2005


Since involving in Microsoft Visual Studio .NET 2005 Beta 1 volunteer test program, I found that there are some new powerful features and functionality in Visual Studio.NET 2005. All these features are based on Microsoft Visual Studio .NET 2005 Beta 1 release, and subjected to change.

1. New Project creation category

In VS.NET 2005 Beta 1, the creation of new project is separated as Web Site for Web-based application and Project for non Web-based application. Figure 1, 2, 3 shows the screen shot of the new project creation wizard. Comparing to the previous Visual Studio.NET 2002/2003, which the project creation wizard mixes up web-based and non web-based application projects together, this feature provides a clear interface for the developer to create their own specific type project more easily.

Figure1 The screen shot of creating a new project in VS.NET 2005 IDE

Sample Image - maximum width is 600 pixels

Figure2 The screen shot of creating a new non web-based project in VS.NET 2005 IDE

Sample Image - maximum width is 600 pixels

Figure3 The screen shot of creating a new web-based project in VS.NET 2005 IDE

Sample Image - maximum width is 600 pixels

2. The new class diagram view in the Visual Studio.NET 2005 IDE

In Visual Studio.NET 2005 IDE, a new feature of class diagram view is provided for the developer easily to take the architecture, design and review jobs. The developer can easily add class into the class diagram by right-clicking the class in class view tab window. Figure 4 shows the feature of class diagram. The class diagram information can be saved in class diagram file (.cd file), which is XML syntax file and currently only can be opened and displayed correctly by Visual Studio.NET 2005 IDE.

The following is a sample content of .cd file.

<?xml version="1.0" encoding="utf-8"?>
<Diagram xmlns:xsi="" 
MajorVersion="1" MinorVersion="1" 
  <View FilterFieldProperty="false" LastOpened="true" Name="Main">
    <AbsoluteBounds X="0" Y="0" Height="8.5" Width="11" />
    <Font Name="Tahoma" Size="0.1145833358168602" />
    <Class Collapsed="true">
      <AbsoluteBounds X="0.75" Y="0.75" Height="0.45" Width="1.5" />
    <Class Collapsed="true">
      <AbsoluteBounds X="0.75" Y="2.5" Height="0.45" Width="1.5" />
    <Class Collapsed="true">
      <AbsoluteBounds X="3.5" Y="0.75" Height="0.45" Width="1.5" />

Figure4 The screen shot of class diagram

Sample Image - maximum width is 600 pixels

3. The separation of program “main” entry from the main form class in C# Windows application

In C# Windows Application project, Visual Studio.NET 2005 defines the program static entry “main” function in a static “Program” class, removed it from the main “Form” class. The static “Program” class is saved normally in Program.cs. This is a brand new feature, which made the code more organized, clearly, effectively and easy to maintain. Inside the new “Program” class, a couple of new (default) application properties are automatically generated by the IDE for the application, such as “EnableVisualStyles” and “EnableRTLMirroring”. “EnableVisualStyles” enables Windows XP visual styles for the application. “EnableRTLMirroring” activates mirroring of the application automatically. The following code shows the difference of “main” entry in source code created by VS.NET 2003 and VS.NET 2005 Beta 1

//(VS.NET 2003 code)

namespace DGDemo
    public class DGDemo : System.Windows.Forms.Form
        static void Main() 
            Application.Run(new DGDemo());
//(VS.NET 2005 Beta 1 code)
namespace WindowsApplication1
    static class Program
        static void Main()
            Application.Run(new Form1());

4. Partial Class Definition in C# and XXX.Design.cs file in C# Windows project

The “partial” key word in C# class definition is not existed in previous Visual Studio.NET 2002/2003. This kind new class definition can split the definition of a class (or a struct, or an interface) over two or more source files. Every source file contains a part of the class definition, and when the application is compiled, all parts are combined together. Programmer can use this new feature on large projects, spreading a class over separate files allows multiple programmers to work on it simultaneously. This will make team working more effectively and easier to debug. When working with automatically generated source, code can be added to the class without having to re-create the source file. Visual Studio uses this approach when creating Windows Forms, Web Service wrapper code and so on. The programmer can create code that uses these classes, without having to edit the file created by Visual Studio. The following shows the sample code with regard to “partial” key word.

namespace WindowsApplication1
    partial class Form1 : Form
        public Form1()
Another related new feature in C# Windows project is the file for UI design layout. In Visual Studio.NET 2005 IDE, for the C# Windows application, all source code related to UI deisgn layout can be automatically generated by the IDE and put in the; the file is hidden from the IDE Project Solution Explorer window, and the source code of can not be viewed directly from IDE. The following is the source code of Form1.Designer.cs generated by VS.NET 2005:
// The source code of Form1.Designer.cs

namespace WindowsApplication1
    partial class Form1
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        protected override void Dispose(bool disposing)
            if (disposing && (components != null))
       this.leftRaftingContainer = 
        new System.Windows.Forms.RaftingContainer();
       this.rightRaftingContainer = 
             new System.Windows.Forms.RaftingContainer();
       this.topRaftingContainer = 
             new System.Windows.Forms.RaftingContainer();
       this.bottomRaftingContainer = 
           new System.Windows.Forms.RaftingContainer();
       this.dataGridView1 = new System.Windows.Forms.DataGridView();
       this.dataGridViewTextBoxColumn1 = 
            new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.dataGridViewTextBoxColumn2 = 
                new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.dataGridViewCheckBoxColumn1 = 
                     new System.Windows.Forms.DataGridViewCheckBoxColumn();
// leftRaftingContainer
            this.leftRaftingContainer.Dock = 
            this.leftRaftingContainer.Name = "leftRaftingContainer";
// rightRaftingContainer
            this.rightRaftingContainer.Dock = 
            this.rightRaftingContainer.Name = "rightRaftingContainer";
// topRaftingContainer
            this.topRaftingContainer.Dock = 
            this.topRaftingContainer.Name = "topRaftingContainer";
// bottomRaftingContainer
            this.bottomRaftingContainer.Dock = 
            this.bottomRaftingContainer.Name = "bottomRaftingContainer";
// dataGridView1
            this.dataGridView1.Dock = System.Windows.Forms.DockStyle.Fill;
            this.dataGridView1.Location = new System.Drawing.Point(0, 0);
            this.dataGridView1.Name = "dataGridView1";
            this.dataGridView1.Size = new System.Drawing.Size(388, 145);
            this.dataGridView1.TabIndex = 16;
// dataGridViewTextBoxColumn1
            this.dataGridViewTextBoxColumn1.HeaderText = "First Name";
            this.dataGridViewTextBoxColumn1.Name = "FName";
// dataGridViewTextBoxColumn2
            this.dataGridViewTextBoxColumn2.HeaderText = "Last Name";
            this.dataGridViewTextBoxColumn2.Name = "LName";
// dataGridViewCheckBoxColumn1
            dataGridViewCellStyle1.Alignment = 
    this.dataGridViewCheckBoxColumn1.DefaultCellStyle = 
            this.dataGridViewCheckBoxColumn1.HeaderText = "Hired";
            this.dataGridViewCheckBoxColumn1.Name = "Hired";
// Form1
            this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
            this.ClientSize = new System.Drawing.Size(388, 145);
            this.Name = "Form1";
            this.Text = "Form1";
            this.Load += new System.EventHandler(this.Form1_Load);



        private System.Windows.Forms.RaftingContainer leftRaftingContainer;
        private System.Windows.Forms.RaftingContainer rightRaftingContainer;
        private System.Windows.Forms.RaftingContainer topRaftingContainer;
        private System.Windows.Forms.RaftingContainer bottomRaftingContainer;
        private System.Windows.Forms.DataGridView dataGridView1;
        private System.Windows.Forms.DataGridViewTextBoxColumn 
        private System.Windows.Forms.DataGridViewTextBoxColumn 
        private System.Windows.Forms.DataGridViewCheckBoxColumn 

5. DataGridView component

DataGridView is a brand new control introduced in Visual Studio.NET 2005 so that the data table presentation feature is much easier to be implemented in C# Windows application. In previous Visual Studio.NET 2002/2003, the DataGrid control is not easy to be used in C# Windows application, the DataGrid control object with sophisticated UI features has to be created manually in the Form source code, the following code shows the source code of a datagraid object with editing and dropdown list feature in a Form created within Visual Studio.NET 2003
// The Datagid demo sample code created with VS.NET 2003 

public class DGDemo : System.Windows.Forms.Form
private System.Windows.Forms.DataGrid            MydataGrid;
private System.Data.DataSet                      MyDataSet;
private System.Windows.Forms.DataGridTableStyle  MyDGStyle;

public DGDemo()


private void CreateDataGrid() 
MyDataSet = new DataSet("MyDataSet");
// Create DataTable.
DataTable myTable = new DataTable("PetInfo");

// Create two columns, and add them to the table.
DataColumn cFirst = new DataColumn("First Name", typeof(string));
DataColumn cLast = new DataColumn("Last Name", typeof(string));

// Add the table to the DataSet.
// Populate the tables. 
DataRow newRow1;
newRow1 = myTable.NewRow();
newRow1["First Name"] = "Black1";
newRow1["Last Name"] = "Bear1";

DataRow newRow2;
newRow2 = myTable.NewRow();
newRow2["First Name"] = "Black2";
newRow2["Last Name"] = "Bear2";

DataRow newRow3;
newRow3 = myTable.NewRow();
newRow3["First Name"] = "Black3";
newRow3["Last Name"] = "Bear2";

DataGridColumnStyle GridFNameColumn;
DataGridColumnStyle GridLNameColumn;
MyDGStyle = new DataGridTableStyle();
MyDGStyle.MappingName = "PetInfo";

CurrencyManager curMgr = 
  (CurrencyManager)this.BindingContext[MyDataSet, "PetInfo"];

GridFNameColumn = new XTextBoxColumn();
GridFNameColumn.MappingName = "First Name";
GridFNameColumn.HeaderText = "First Name";
GridFNameColumn.Width = 140;

GridLNameColumn = new XComboBoxColumn();
GridLNameColumn.MappingName = "Last Name";
GridLNameColumn.HeaderText = "Last Name";
GridLNameColumn.Width = 140;

MyDGStyle.AllowSorting         = true;
MyDGStyle.RowHeadersVisible    = true;

((XComboBoxColumn)GridLNameColumn).AttachParentObject(MydataGrid, curMgr);

In the new VS.NET 2005, DataGridView control provides a visual table layout for displaying data. All datagridview control creating works are just dragging and dropping into the IDE design layout window. Figure5 The screen shot of dragging Datagridview control from toolbox

Sample Image - maximum width is 600 pixels

Figure 6 The screen shot of adding columns to Datagridview control

Sample Image - maximum width is 600 pixels

Figure 7 The screen shot of the Datagridview control's column heading editing

Sample Image - maximum width is 600 pixels

Figure 8 The screen shot of the Datagridview control's column type editing

Sample Image - maximum width is 600 pixels

Figure 9 The screen shot of the datagrid design layout

Sample Image - maximum width is 600 pixels

Figure 10 The screen shot of run-time Datagridview layout

Sample Image - maximum width is 600 pixels

The datagridview control’s property can be customized and the control object can be linked with or without datasource. Other UI feature controls such as button control, check control, combobox, link control and image control can be placed into the datagridview object through the IDE Edit Column function.

6. Some other new UI controls

  • MaskedTextBox This new control can verify user’s input without custom validation logic and can be applied to decide whether accept or reject user’s input.
  • Menustrip This control defines menu system for a form.
  • FlowLayoutPanel and TableLayoutPanel In VS.NET 2005 Beta 1, the Panel control become two separate parts of FlowLayoutPanel and TableLayoutPanel. FlowLayoutPanel control can define its contents in flow direction, or you can use TableLayoutPanel control can define its contents in table direction, a grid with rows and columns.
  • DataConnector This control will provide data connecting to data source.
  • DataNavigator This is a data navigation control which can be put on the form interface.
  • SoundPlayer This control can play a sound from a .wav file.
  • ActiveDocumentHost This control can host an active document, such as MS Word document, Excel worksheet, Sound, Visual drawing, Media clip, Video clip, MS Photo editor, MS PowerPoint, WordPad etc.
  • PropertyGrid This control provides a user interface to browse the properties of an object.
  • WebBrowser This control can browse web page or provide integrated HTML-based user assistance.


This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


About the Author

Zuilin Wu
Web Developer
Canada Canada
.Net developer

Comments and Discussions

QuestionHow can I validate my cells in DataGridView in VB.Net? Pin
RoopeshMandloi19-Jan-09 19:05
MemberRoopeshMandloi19-Jan-09 19:05 
GeneralVisual 2005 Pin
jake3604-Aug-08 19:56
Memberjake3604-Aug-08 19:56 
GeneralDataGridView selected row Pin
mikobi28-Jun-07 22:23
Membermikobi28-Jun-07 22:23 
Questiondatagridview update question URGENT! Pin
Eric Weaver10-Oct-06 17:32
MemberEric Weaver10-Oct-06 17:32 
GeneralDatagridView rotate Pin
horvat9-May-06 19:52
Memberhorvat9-May-06 19:52 
QuestionDataGrdiView - Selected Row Indicator Pin
BillMcNeil14-Feb-06 15:49
MemberBillMcNeil14-Feb-06 15:49 
AnswerRe: DataGrdiView - Selected Row Indicator Pin
jlkp8-Mar-06 5:47
Memberjlkp8-Mar-06 5:47 
GeneralActiveDocumentHost Pin
Bested26-Oct-05 2:38
MemberBested26-Oct-05 2:38 
GeneralIs it a Software Development Framework Pin
Ishara Gunarathna31-Jan-05 17:19
MemberIshara Gunarathna31-Jan-05 17:19 
GeneralCreating column programatically in VS 2005 Pin
Kasie10-Jan-05 6:11
MemberKasie10-Jan-05 6:11 
General.NET 2005 with mySQL Pin
Member 80385673-Dec-04 23:36
MemberMember 80385673-Dec-04 23:36 
GeneralGood job Pin
fgshen10-Sep-04 6:20
Memberfgshen10-Sep-04 6:20 
GeneralRe: Good job Pin
jake3604-Aug-08 20:08
Memberjake3604-Aug-08 20:08 
GeneralI didn't find any *.cd file Pin
Dhirendra26-Aug-04 21:37
MemberDhirendra26-Aug-04 21:37 
GeneralRe: I didn't find any *.cd file Pin
Jacob Buys14-Nov-04 3:53
MemberJacob Buys14-Nov-04 3:53 
GeneralThx. Pin
Tom Dziedzic24-Aug-04 12:47
MemberTom Dziedzic24-Aug-04 12:47 
GeneralThe PropertyGrid isn't new Pin
ip25524-Aug-04 12:46
Memberip25524-Aug-04 12:46 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.