Re: Help with MSFlexgrid!
Here is API to scroll msfg
WM_VSCROLL message to an MSFlexGrid control it moves the scrollbar and contents.
private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (byval hwnd as Long, byval wMsg as Long, byval wParam as Long, lParam as Long) as Long
private Const WM_VSCROLL = &h115
'to scroll a grid upwards, wParam is 0
public Sub ScrollGridUp(byval fg as MSFlexGrid)
Dim lRet as Long
lRet = SendMessage(fg.hwnd, WM_VSCROLL,0,0)
End Sub
'to scroll a grid down, wParam is 1
public Sub ScrollGridDown(byval fg as MSFlexGrid)
Dim lRet as Long
lRet = SendMessage(fg.hwnd, WM_VSCROLL,1,0)
End Sub
Iouri Boutchkine
[email protected]
Re: Help with MSFlexgrid!
Here is how you can scroll page up and down and go to the top/bottom
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
'Constant
Const WM_VSCROLL = &H115
Const SB_BOTTOM = 7
Const SB_TOP = 6
Const SB_PAGEDOWN = 3
Const SB_PAGEUP = 2
Private Sub Command2_Click()
SendMessage MSFG.hwnd, WM_VSCROLL, SB_BOTTOM, 0
'MSFG is my FlexGrid control, can be cha
' nged to ListBox
End Sub
Private Sub Command3_Click()
SendMessage MSFG.hwnd, WM_VSCROLL, SB_TOP, 0
End Sub
Private Sub Command4_Click()
SendMessage MSFG.hwnd, WM_VSCROLL, SB_PAGEDOWN, 0
End Sub
Private Sub Command5_Click()
SendMessage MSFG.hwnd, WM_VSCROLL, SB_PAGEUP, 0
End Sub
Iouri Boutchkine
[email protected]
Re: Help with MSFlexgrid!
Also you can go to the selected row using TopRow property
That is a property of MSFG.
Set it to desired row value, and it will become top row. So, if you want that particular record will be in the
middle of control, you can set TopRow to value, say, 10 less than desired row (of course, desired row must
have at least 10 rows above it.
'example
Private Sub MSFlexGrid1_Scroll()
Label1.Caption = MSFlexGrid1.TopRow & " / " & MSFlexGrid1.Row & " / " & MSFlexGrid1.Rows
End Sub
Iouri Boutchkine
[email protected]