Working with the Grid Control

Team-Fly

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


ADO Examples and Best Practices
Ado Examples and Best Practices
ISBN: 189311516X
EAN: 2147483647
Year: 2000
Pages: 106

Similar book on Amazon

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net