In most of the examples you've seen in earlier chapters, I used the MSHFlexGrid as the target of choice. That's because it exposes a Recordset property that can accept the default firehose cursor. However, you can also use the Visual Basic Data Grid control to display your rows. Actually, it seems to handle headers better than the MSHFlexGrid control, so it might be a better choice if you are using a "bookmarkable" (ADO's term) Recordset. That is, if the Recordset object's Supports method indicates that Bookmarks are supported (adBookmark), you can pass this Recordset directly to the DataGrid control's DataSource property. Here's an example:
Tip | To ensure that the DataGrid morphs itself to the Field name or data widths property, make sure you leave the DefColWidth property set to 0. |
Set rs = New Recordset rs.CursorLocation = adUseClient cn.au42 1900, 1950, rs Set DataGrid1.DataSource = rs
Team-Fly |