msHflexgrid scrollbar 
Author Message
 msHflexgrid scrollbar


I need to set a fixed vertical scrollbar on my msHflexgrid, even if there is
no scrolling, or, If I will know if the vertical scrollbar is visible or
not, it will also help me. How can I do that?


Fri, 17 Jun 2005 22:12:35 GMT  
 msHflexgrid scrollbar
Place an MSHFlexgrid and a vScroll bar on a form. Paste the following code into the form load event...

Dim Rs As ADODB.Recordset
Dim Cn As ADODB.Connection
Set Cn = New ADODB.Connection
Cn.CursorLocation = adUseClient

VScroll1.Visible = False

Cn.Open "Provider=Microsoft.Jet.Oledb.4.0;Data Source=D:\NorthWind.mdb;"

Set Rs = New ADODB.Recordset
Rs.Open "Select top 11 CustomerID from Customers", Cn, adOpenStatic, adLockOptimistic

Set MSHFlexGrid1.DataSource = Rs
Dim Total As Integer
For x = 0 To MSHFlexGrid1.Rows - 1
Total = Total + MSHFlexGrid1.RowHeight(x)
Next x
If Total < MSHFlexGrid1.Height Then VScroll1.Visible = True

This code assumes no HScrollbar. With an HScrollbarr you will have to make similar calculations using the Column Widths rather than RowHeight.

Want to know more? Check out the MSDN Library at  or the Microsoft Knowledge Base at

Scot Rose, MCSD
Microsoft Visual Basic Developer Support

This posting is provided AS IS, with no warranties, and confers no rights.

Sat, 18 Jun 2005 22:39:30 GMT  
 [ 2 post ] 

 Relevant Pages 

1. MSHFlexGrid ScrollBar Question

2. how to make MshFlexgrid scrollbar visible ?

3. MSHFlexGrid Scrollbar properties?

4. MSHFlexGrid ScrollBar Question

5. Flash Scrollbar or Change Scrollbar Color

6. When the Treeview scrollbar moves the FlexGrid Scrollbar should also move

7. Scrollbar not shown

8. Subform Scrollbar

9. Scrollbar doesnt show

10. Width of scrollbar, recordselector

11. Getting Scrollbar Visibility

12. scrollbar functionality


Powered by phpBB® Forum Software