DataGrid versus DataGridView

DataGridViewColumns .NET assembly
More about DataGridViewColumns.dll
Download DataGridViewColumns.dll
Order DataGridView Columns

DataGridView Windows Forms control

The DataGridView Windows Forms control is a quite new .NET control introduced in MS Visual Studio .NET 2005 that is a good alternative to the VS .NET 1.x DataGrid control. The DataGridView control is a new control presented in .NET framework 2.0 that replaces the DataGrid control. The DataGridView control provides a large amount of features that are not presented in the DataGrid control, and it much easier to expand and adjust than the DataGrid .NET control. The data table presentation feature became much easier to be implemented in .NET Windows application. The DataGridView control has the following features that are not available in the DataGrid .NET control:
It allows to mix both data bound and unbound, virtual columns in the GridView. The DataGridView control can display unbound data stored in the control, data from a bound data source, or bound and unbound data together. You may also implement virtual mode in the DataGridView control to provide custom data management.
It has a special virtual mode allowing to actually display more than 100 000 rows without a huge performance hit.
It gives ability to easily apply styles to individual columns, rows, cells, or an entire data source table. You can congeal rows and columns to prevent them from scrolling; hide rows, columns, and headers; change the way row, column, and header sizes are adjusted; change the way users make selections; and shortcut menus for particular columns, rows, and cells.
The DataGridView control provides more built-in column types than the DataGrid control.
It provides many properties and events for DataGridView .NET control that allow you to define a way how data is displayed and formatted. You may change the appearance of columns, rows, and cells depending on the data they present, or you may replace data of one data type with equivalent data of another data type.

There is only one feature that is not available in the DataGridView .NET control that is available in the DataGrid control is the hierarchical view of information from many related tables (DataSet tables) in a single control. You must use two (three or more) DataGridView controls to display information from two (three or more) tables that have a parent/child relationship.

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 ability to display hierarchical data. This is a big advantage of DataGrid .NET Windows Forms control.
In Visual Studio .NET 1.x, the DataGrid control is not easy to be used in .NET Windows application. A quantity 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 attain most tasks, you have to work with the columns, not the cells themselves.
DataGridColumns .NET assembly from RustemSoft is a DataGrid Columns Styles software package specifically designed for .NET developers. The assembly allows you to use all strengths of the MS Windows .NET forms DataGrid control without waiving the user interface elements your customers need. Learn more about DataGridColumns .NET assembly
DataGridColumns dynamic link library contains the following DataGrid Column Styles:

  • DataGrid combobox
  • DataGrid XPButton column Style
  • DataGrid Memo column Style
  • DataGrid Button column Style
  • DataGrid DateTimePicker column Style
  • DataGrid DateTime Column Style
  • DataGrid Numeric Column Style
  • DataGrid Print Class
  • DataGrid Text Fractions Column Style
  • DataGrid Check Column Style
  • DataGrid Label Column Style
  • DataGrid TextEdit Column Style
  • DataGrid DomainUpDown Column Style
  • DataGrid NumericUpDown Column Style
  • DataGrid Picture Column Style
  • VB .NET

    Private Sub AddDataGridColumn()
    Dim dataset As New DataSet
    ' Put some actions to populate the dataset
    Dim TblStyle As New DataGridTableStyle
    With TblStyle
    ' Set column style
    With .GridColumnStyles
    ' Set datagrid ComboBox ColumnStyle for PubID field
    .Add(New DataGridComboBoxColumn(dataset.Tables.Item("Companies"), 1, 0))
    With .Item(0)
    .MappingName = "PubID"
    .HeaderText = "Company ID"
    .Width = 150
    .NullText = String.Empty
    End With
    End With
    End With
    ' Add TableStyle
    End Sub


    private void AddDataGridColumn()
    DataSet dataset = new DataSet();
    // Put some actions to populate the dataset
    // Set column style
    DataGridTableStyle TblStyle = new DataGridTableStyle();
    // Set datagrid ComboBox ColumnStyle for PubID field
    DataTable tblCompanies = dataset.Tables["Companies"];
    TblStyle.GridColumnStyles.Add(new DataGridComboBoxColumn(ref tblCompanies, 1, 0, true, false, true, DataGridComboBoxColumn.DisplayModes.ShowDisplayMember,0));
    TblStyle.GridColumnStyles[0].MappingName = "PubID";
    TblStyle.GridColumnStyles[0].HeaderText = "Company ID";
    TblStyle.GridColumnStyles[0].Width = 150;
    TblStyle.GridColumnStyles[0].NullText = string.Empty;
    // Add TableStyle

    The above example creates a DataGridComboBoxColumn and adds it into DataGrid TableStyle.

    DataGridView Columns .NET 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 just dragging and dropping into the IDE design layout window. The DataGridView .NET 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 attain most tasks, you have to work with the columns, the same way like with the DataGrid control.
    In November 2005, Microsoft officially released the new Visual Studio 2005 also known as .NET. RustemSoft is presenting a software package for customizing your .NET Windows Forms DataGridView Columns.
    DataGridViewColumns .NET assembly from RustemSoft is a DataGridView Columns software package specifically designed for .NET developers. The assembly allows you to use all strengths of the MS Windows .NET forms DataGridView control without waiving the user interface elements your customers need. Learn more about DataGridViewColumns .NET assembly
    DataGridViewColumns dynamic link library contains the following DataGridView Columns: Combo (extended combobox), Memo column, DateTimePicker column. Also the assembly includes the formatting intelligent 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 DataGridView Columns, that make it easy to build professional and forcing user interfaces.

    VB .NET

    With DataGridView1
    ' Set DataGridView Combo Column for CarID field
    Dim ColumnCar As New DataGridViewComboColumn
    ' DataGridView Combo ValueMember field has name "CarID"
    ' DataGridView Combo DisplayMember field has name "Car"
    With ColumnCar
    .DataPropertyName = "CarID"
    .HeaderText = "Car Name"
    .Width = 80
    ' Bind ColumnCar to Cars table
    .box.DataSource = ds.Tables("Cars")
    .box.ValueMember = "CarID"
    .box.DisplayMember = "Car"
    End With
    End With


    // Set DataGridView Combo Column for CarID field
    DataGridViewComboColumn ColumnCar = new DataGridViewComboColumn();
    // DataGridView Combo ValueMember field name is "CarID"
    // DataGridView Combo DisplayMember field name is "Car"
    ColumnCar.DataPropertyName = "CarID";
    ColumnCar.HeaderText = "Car Name";
    ColumnCar.Width = 80;
    // Bind ColumnCar to Cars table = ds.Tables["Cars"]; = "CarID"; = "Car";
    // Add ColumnCar onto DataGridView layout

    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 Framework includes six types of DataGridView column classes by default: DataGridViewButtonColumn, DataGridViewCheckBoxColumn, DataGridViewComboboxColumn, DataGridViewImageColumn, DataGridViewTextBoxColumn, and DataGridViewLinkColumn classes. RustemSoft DataGridViewColumns dynamic link library contains the following DataGridView Columns:

    DataGridView Combo Column (extended combobox)
    DataGridView Memo Column
    DataGridView DateTimePicker Column
    DataGridView DateTime Column
    DataGridView Numeric Column
    DataGridView Text Fractions Column
    DataGridView Label Column
    DataGridView DomainUpDown Column
    DataGridView NumericUpDown Column
    DataGridView Picture Column
    DataGridView MaskedTextBox Column
    DataGridView Print Class

    Skater .NET Obfuscator
    More about Skater .NET Obfuscator
    Download Skater .NET Obfuscator
    Order Skater .NET Obfuscator

    Controls .NET assembly (WinForms)
    More about RustemSoft.Controls.dll
    Download RustemSoft.Controls.dll
    Order RustemSoft.Controls.dll

    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 build for .NET WinForms DataGridView control and very helpful for your .NET 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 form) to draw the DataGridView object content that should be printed. An object of the class is used for a .NET 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 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

    Copyright © 2001-2022 Rustemsoft LLC