1 / 10

DataGridView Tips and Tricks

DataGridView Tips and Tricks. Code Camp 2008 Emmet Gray http://home.hot.rr.com/graye. Introduction. DataGridView Provides a GUI for tabular data Look and feel of Excel The DataGridView control New in .Net Framework 2.0 Replaces the older DataGrid control

Download Presentation

DataGridView Tips and Tricks

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. DataGridViewTips and Tricks Code Camp 2008 Emmet Gray http://home.hot.rr.com/graye

  2. Introduction • DataGridView • Provides a GUI for tabular data • Look and feel of Excel • The DataGridView control • New in .Net Framework 2.0 • Replaces the older DataGrid control • Windows Form applications only • Not really related to the Web DataGrid control

  3. Example

  4. Gee Wiz Facts • One of the largest controls in the .Net Framework • It’s huge! • Methods: 359 • Properties: 167 • Events: 187

  5. Example • Live demo of “fully automated mode” • New Data Source • Strongly-typed DataSet, TableAdapter • Automatic column generation • Weaknesses of this approach

  6. GUI “Rules of the Game” Design attributes: Intuitive, Responsive Data attributes: Maintain referential integrity Human interface: Ease of use, prevent input errors

  7. Column Types • Out-of-the-box Column Types • DataGridViewTextBoxColumn • DataGridViewCheckBoxColumn • DataGridViewImageColumn • DataGridViewComboBoxColumn • DataGridViewLinkColumn • Only the first 3 column types are automatically generated

  8. Examples • Use of ComboBox column type • Custom column formatting • RowValidating and ErrorProvider control • Global Error checking • Custom Column type

  9. MaskedEditColumn • Custom DataGridViewColumn type uses MaskedEditTextBox control as the base type • It’s always better to prevent user input errors than to detect them

  10. End Notes • The DataGridView control is very versatile • Fully automated mode • Hand tweaking for • Better look and feel • Data Integrity • Error Detection/Error Prevention • Custom column types • Source code is available at: http://home.hot.rr.com/graye/Articles/DataGridView.htm

More Related