DataGridView versus DataGrid
- Date: 2007-04-25 - Word Count: 1008
Share This!
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 data table presentation feature became much easier to be implemented in .NET Windows application. The most attractive features of the new control are:
It allows to mix both data bound and unbound, virtual columns in the GridView.
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.
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: http://www.smrtx.com/RS/datagrid_net.htm
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
DataGrid1.TableStyles.Add(TblStyle)
End Sub
C#
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
DataGrid1.TableStyles.Add(TblStyle);
}
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 just dragging and dropping into the IDE design layout window. 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 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 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 use all strengths of the MS Windows .NET 2.0 forms DataGridView control without waiving the user interface elements your customers need. Learn more about DataGridViewColumns .NET assembly: http://www.smrtx.com/RS/datagridview_columns.htm
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 2.x 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
.Columns.Add(ColumnCar)
End With
C#
// 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
ColumnCar.box.DataSource = ds.Tables["Cars"];
ColumnCar.box.ValueMember = "CarID";
ColumnCar.box.DisplayMember = "Car";
// Add ColumnCar onto DataGridView layout
DataGridView1.Columns.Add(ColumnCar);
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, 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
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 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 '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: http://rustemsoft.com/datagridview_columns2.htm#E
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 data table presentation feature became much easier to be implemented in .NET Windows application. The most attractive features of the new control are:
It allows to mix both data bound and unbound, virtual columns in the GridView.
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.
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: http://www.smrtx.com/RS/datagrid_net.htm
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
DataGrid1.TableStyles.Add(TblStyle)
End Sub
C#
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
DataGrid1.TableStyles.Add(TblStyle);
}
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 just dragging and dropping into the IDE design layout window. 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 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 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 use all strengths of the MS Windows .NET 2.0 forms DataGridView control without waiving the user interface elements your customers need. Learn more about DataGridViewColumns .NET assembly: http://www.smrtx.com/RS/datagridview_columns.htm
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 2.x 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
.Columns.Add(ColumnCar)
End With
C#
// 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
ColumnCar.box.DataSource = ds.Tables["Cars"];
ColumnCar.box.ValueMember = "CarID";
ColumnCar.box.DisplayMember = "Car";
// Add ColumnCar onto DataGridView layout
DataGridView1.Columns.Add(ColumnCar);
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, 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
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 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 '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: http://rustemsoft.com/datagridview_columns2.htm#E
Related Tags: net, control, class, component, columns, assembly, column, datagridview, datagrid, combobox, columnstyle, winforms, visual studio, data bound, databo
Your Article Search Directory : Find in Articles
Recent articles in this category:
- Ringtones for Cell Phones 101
A ringtone is a sound file that is used on acellular or mobile phone. This smart idea was deve - Sony Reader PRS-505 Review - Is it Worth Your Money?
The Sony Reader 505 has become an attractively affordable ebook reader since the Sony Reader P - Prototyping knowledge: about an .STL file and how to save it?
Following are guidelines for exporting from typical CAD modelers:Most CAD systems, File Save a - Logitech Digital Video Security System
Since the dawn of time people have always been afraid of others coming into their cave, it's a - The History of GPS Technology
Normal 0 false false false MicrosoftInternetExplorer4 /* Sty - The Future of VOIP Technology
Normal 0 false false false MicrosoftInternetExplorer4 /* Sty - 10 Things You Need to Know About NY VOIP
Normal 0 false false false MicrosoftInternetExplorer4 /* Sty - Video Cameras
Today, video cameras are extremely affordable, very easy to use and offer high quality video a - Making Data Administration a Part of Your Small Business
At some point it will happen to every company no matter how big orsmall they are. System failu - How to Choose a New York VOIP Service Provider
New Yorkers know a good thing when they see it, and VOIP technology iscurrently taking the Emp
Most viewed articles in this category:
- Bluesnarfing
IntroductionBluetooth a short range wireless communication technology developed for use at home, off - Visibility Eto Erp and Six Sigma Profiled in Quality Digest
According to Stephen Carson, executive vice president for Visibility Corp., "Many project-based manu - Four Trends for Distributors: Facing the Forces of Change
The four definitive trends listed in the National Association of Wholesalers-Distributors' publicati - Gateway Laptop Review
You may consider the M255-E if you are thinking about purchasing a Gateway laptop. At first glance, - Ipod Buying Guide &Tips - Ipod, Nano, Shuffle
Buying Ipod is just like buying a piece of enjoy-ment. The first criteria is to buy something you w - Texas Cement Choose Batchmaster for Process Manufacturing Erp
BatchMaster Software, Inc. (www.batchmaster.com), a leading provider of ERP (enterprise resource pla - Industrial CRM Must be Preceded by Change Management
Entitled Smart Practices That Pay: Leveraging Information to Achieve Industrial Selling Results, thi - Canada's Cosmaceutical Wins With Batchmaster ERP
Cosmaceutical Research Lab, already the largest contract manufacturer for cosmetic products in weste - Science is the Real God
Every religion in the world claims that its particular God is almighty. However, there is nothing in - Still wondering what VoIP is about?
So what is VoIP? Internet telephony is a rapidly-growing phenomenon that shows no sign of slo