Published: 07 Feb 2007
By: Rustem Soft

The DataGridView Windows Forms control is a new .NET control introduced in MS Visual Studio .NET 2005 that is a good alternative to the VS .NET 1.x DataGrid control.

Introduction

Within the DataGridView .NET 2.x control the data table presentation features became much easier to implement in .NET Windows application. The most attractive features of the new control are:

  • It allows for the mix both data bound and unbound, virtual columns in the GridView.
  • It has a special virtual mode allowing for the display of more than 100.000 rows without a huge performance hit.
  • Individual columns, rows, cells or an entire data source can easily be styled.

DataGrid Windows Forms control

Obviously we do not need to disregard the .NET DataGrid control. For most situations it works faster than the new DataGridView. Also the control gives you the ability to display hierarchical data. This is a big advantage for the DataGrid .NET Windows Forms control.

In Visual Studio .NET 1.x, the DataGrid control is not easy to use in .NET Windows application. A number of jobs you may want to achieve with the Windows Forms DataGrid control are, unexpectedly, more troublesome than you might expect. Principally, this is because the Windows Forms DataGrid control is column-based, rather than cell-based. As a result, to accomplish most tasks, you have to work with the columns, not the cells themselves.

The DataGridColumns .NET assembly from RustemSoft is a DataGrid Columns Styles software package specifically designed for .NET developers. The assembly allows you to use all the strengths of the MS Windows .NET forms DataGrid control without sacrificing the user interface elements your customers need. Learn more about DataGridColumns .NET assembly here.

VB.NET: C#: The above example creates a DataGridComboBoxColumn and adds it into DataGrid TableStyle.

DataGridView Columns .NET 2.0 assembly

In the new MS Visual Studio .NET 2005, the DataGridView control provides a visual table layout for displaying data. All DataGridView control designing operations are done through the IDE design layout window via drag and drop. The DataGridView .NET 2.0 control seems a lot better than DataGrid .NET 1.x control. It provides a powerful and flexible way to display a data source. You can extend the DataGridView control in a number of ways to build custom behaviors into your applications. Although you can create your own types of cells the Windows Forms DataGridView control is mostly column-based, rather than cell-based. As a result, to accomplish most tasks, you have to work with the columns, just like the DataGrid control.

In November 2005, Microsoft officially released the new Visual Studio 2005 also known as .NET 2.0. RustemSoft is presenting a software package for customizing your .NET 2.0 Windows Forms DataGridView Columns.

DataGridViewColumns .NET 2.0 assembly from RustemSoft is a DataGridView Columns software package specifically designed for .NET 2.0 developers. The assembly allows you to leverage all of the strengths of the MS Windows .NET 2.0 forms DataGridView control without sacrificing the user interface elements your customers need. Learn more about DataGridViewColumns .NET assembly here.

The DataGridViewColumns dynamic link library contains the following DataGridView Columns:

  • Combo (extended combobox)
  • Memo column
  • DateTimePicker column

The assembly also includes the intelligent formatting for DateTimeColumn, NumericColumn, TextFractionsColumn, MaskedTextBox column controls that can mask the date, time, numbers as well as the text fractions. It gives you ability to manage the IP Address, SS#, Phone numbers, etc., and checks the validation, and automatically set the delimiter location. These Column classes are chock full of functionality that you will not find in the standard Microsoft .NET 2.x DataGridView Columns, making it easier to build professional user interfaces.

VB.NET: C#:

The code above presents DataGridViewCombo Column usage.

Extended DataGridView columns

The DataGridView control properties can be customized and the control object can be linked with or without an assigned DataSource object. The .NET 2.0 Framework includes six types of DataGridView column classes by default:

  • DataGridViewButtonColumn
  • DataGridViewCheckBoxColumn
  • DataGridViewComboboxColumn
  • DataGridViewImageColumn
  • DataGridViewTextBoxColumn
  • DataGridViewLinkColumn

RustemSoft DataGridViewColumns dynamic link library contains the following DataGridView Columns:

  • DataGridViewComboColumn (extended combobox)
  • DataGridViewMemoColumn
  • DataGridViewDateTimePickerColumn
  • DataGridViewDateTimeColumn
  • DataGridViewNumericColumn
  • DataGridViewTextFractions Column
  • DataGridViewLabelColumn
  • DataGridViewDomainUpDownColumn
  • DataGridViewNumericUpDownColumn
  • DataGridViewPictureColumn
  • DataGridViewMaskedTextBoxColumn
  • DataGridViewPrintClass

The DataGridViewPrint service class is intended to help you to create a print output based on your DataGridView content. The class has been included into the assembly since it is built for .NET 2.0 WinForms DataGridView control and very helpful for your .NET 2.0 DataGridView design. It will help you to implement an application with a print preview and a print support.

The DataGridViewPrint class is used by the Print dialog and DataGridViewPrintPreview dialog (on your .NET 2.0 form) to draw the DataGridView object content that should be printed. An object of the class is used for a .NET 2.0 PrintDocument object.

Also the special DataGridViewPrintPreview class has been designed and added to the assembly. The class gives the ability to print DataGridView content by clicking ‘Print’ button located on the dialog window. Also, a ‘Save to file’ button is added onto Preview dialog layout. It allows you to save the print document into a bitmap image file. Learn more about DataGridViewPrint Service class here.

References

DataGridView Columns .NET 2.0 assembly

Continue reading and see our next or previous articles Next Article >>

About Rustem Soft

Sorry, no bio is available

This author has published 2 articles on DotNetSlackers. View other articles or the complete profile here.

Other articles in this category


The DigitalCounter Control
The DigitalCounter is an implementation of the famous 7 segment display. In this article you will le...

You might also be interested in the following related blog posts


LINQ To SQL read more
Extending the GridView to Include Sort Arrows read more
Custom Editing Behavior for DataGridView TextBox Columns read more
Accessing ClientID or UniqueID too early can cause issues read more
Customizing columns in ASP.Net DataGrids read more
Customizing the GridView Pager read more
How to a jump-to-page feature to enhance the DataGrid pager - level 200 read more
DVXP's TEdit.NET Control read more
An ASP.NET Custom Control for Dynamically Filtering Data - DataSetFilter read more
The DataGrid is Dead Long-live the DataGrid (Part 1 of N) read more
Top
 
 
 

Please login to rate or to leave a comment.

Free Agile Project Management Tool from Telerik
TeamPulse Community Edition helps your team effectively capture requirements, manage project plans, assign and track work, and most importantly, be continually connected with each other.