Click to See Complete Forum and Search --> : Refreshing MSHFlexGrid - How To?


chaseltine
December 14th, 1999, 02:45 PM
I am having difficulty trying to get an MSHFlexGRid on a VB form, bound during run time to an ado recordset object, to refresh properly. The scenario I need to accomplish, and the code I am attempting to use are as follows:

The MSHFlexgrid is bound to an ado recordset object (NOT to an ado control)in a form I will call form1 . When the user double clicks on a row in the MSHFlexGrid, I launch form2 for data entry into the database, and unload form1. When the user is done with form2, I unload form2 and reload form1. I also attempt to return the highlight on the MSHFlexGRid back to the exact row on the MSHFlLexGrid the user launched from. This is where my problem comes in. I can't get the highlight to return to the row the user left from on the MSHFLexGrid. I have tried the following without much success, so any advice or input would be greatly appreciated.

'declarations
Private EmployeeRS As ADODB.Recordset
Private GridLocation as Integer

.......'grid location is the row above the row
.......'I want to return the
.......'highlight to on MSHFlexGrid


Form1.show 'performed first
...' then code to query db, and set
...' MSHFlexGrid.datasource = EmployeeRs
...' then call resetfocus below


public Sub ResetFocus
MSHFlexGrid1.HighLight = flexHighlightWithFocus
MSHFlexGrid1.Setfocus 'set focus on grid
MSHHFlexGrid1.TopRow = GridLocation
MSHFlexGrid1.LeftCol = 1
SendKeys "Down" 'move highlight to next row
End Sub






chaseltine