Working with the Grid Control


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:


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 


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

Similar book on Amazon © 2008-2017.
If you may any questions please contact us: