DataView for objects: What’s in the box
In my previous post I made the case for having a DataView-style construct for collections of arbitrary objects. In this post, I'll review what you can (and can't) do to achieve this with the built-in .NET 2.0 Framework classes. View vs. Collection First, why use a "view" rather than just a collection? For the same reason we would use a DataView rather than a DataTable. Let's say we want to present some customer data in a DataGridView ...
DataView for objects?
I've often wanted something like the DataView for a collection of my own data objects. DataView allows you to present a sorted, filtered subset of the rows in a DataTable, without actually changing the underlying table. You can bind two DataViews of the same table to two different Windows Forms controls, using a different sort and filter in each. Very groovy. Unfortunately, DataView only provides this goodness for the DataTable class. ...
DataSet Visualizer for Visual Studio 2005
I work with DataSets quite a bit, and I'm a fan of the DataSet visualizers that were available for VS 2003. The DataSet QuickWatch and the XML Visualizer were two that I used a lot. In particular, XML Visualizer allowed you to display all of the different data versions available in a DataRow. Visual Studio 2005 ships with a DataSet visualizer, but it doesn't make all of the row versions available, nor does it show the row state. So, I ...
DataGridView: Where’s my tooltip?
If you've worked with the .NET 1.1 DataGrid control, you'll appreciate the enhanced DataGridView control of the 2.0 runtime. I was mystified for a moment, however, when setting a tooltip on the grid failed to have any effect. My code looked like this: DataGridView.HitTestInfo info = grid.HitTest(e.X, e.Y); if (info.RowIndex > -1) { OrdersRow row = (OrdersRow)((DataRowView)grid.Rows[info.RowIndex].DataBoundItem).Row; ...
WinForms Databinding, Part II: Format & Parse
In my last entry, I described the .NET 1.1 simple data binding mechanism: an object property is bound to a control property, and a change in either the object property value or the control property is reflected in the other. Today, I will describe what happens when these two properties are of different types. For the following discussion, assume an Invoice class with an integer Amount property. The Amount property of an Invoice is bound ...