We help IT Professionals succeed at work.

MSHFlexgrid issue

mmcmillen asked
I am using a MSHFlexgrid in VB 6.0.   This grid is on a frame .   I access the frame by clicking antoher grid to grab a record, then clicking a button .  this button clears the grid , populates it.  Displays the frame.  This works fine.   the issue is this.     Lets say the first time the grid is displayed it shows 100 records but I use scroll bar to see them.  When I go back and reselect new data to look at, click the button, clear the grid, populate the grid, display the frame   the scroll bar is at the position last used,  scrolled down, not at the top or first record of the grid.    I have never had this problem but suspect it has something to do with the grid being on the same form.  Other ties I have used grids they were on different forms and thus all the settings were reset, I believe.  Any ideas if that is the case and how to get the scroll bar to set correctly?   Also,  any idea why snice moving to XP my wheel mouse doesnt work on grids in vb 6?
Watch Question

You can set the scrollbar's Min to 1 and max to RecordCount and then set the value to whatevery you want.
Depending on the control object you use you may need to send:
ControlName.Update  or  ControlName.Refresh


how do I do that on a MSHFlexgrid?  I dont see any properties specifically for the scrollbar.  
I am having a problem loading MSHFLXGD.OCX within Vista.

When you set .Row=number the RowSel and ColSel are automatically reset and become the current cell.
Sometimes in VB you have to send a .Refresh to the control, kind of like a DoEvents to give it a chance to repaint itself.

If a control dosen't have a property 'available' within vb environment you can use object.hWnd to get the handle which will let you use an API to do just about anything.

When I get the component added I can give you more help.


I fixed it.    I used   grd.rows =  my default value of rows for the grid.    Thanks for the help .   Not exactly the answer but got me looking in the right place.

Explore More ContentExplore courses, solutions, and other research materials related to this topic.