first i will populate mshflexgrid1 , what im trying to do is when i click a row in mshflexgrid1 , the same row will be highlighed in flexgrid2 and listview . thx
Printable View
first i will populate mshflexgrid1 , what im trying to do is when i click a row in mshflexgrid1 , the same row will be highlighed in flexgrid2 and listview . thx
Use the RowSel property of the flexgrid.
Code:Option Explicit
Private Sub MSFlexGrid1_SelChange()
If MSFlexGrid1.RowSel > 0 Then
'Select your corresponding row in your other control using the .RowSel value
End If
End Sub
when will the MSFlexGrid1_SelChange occur? do u have sample program,? thx
It will fire when something that has been selected changes.
I posted "sample code" for you. When you make a selection the "MSFlexGrid1_SelChange" event will fire which is where you can write your code to programmatically select your corresponding row in your listview or ???
what is did was..
but the flexgrid2 has a highlighting problem,highlighting multiple rows and never really highligting the selected row in flexgrid1Code:Private Sub MSHFlexGrid1_Click()
MSHFlexGrid2.RowSel = MSHFlexGrid1.RowSel
End Sub
Set the row/col positions on the second grid first before changing the selection.
Code:MSFlexGrid2.Col = MSFlexGrid1.Col
MSFlexGrid2.Row = MSFlexGrid1.Row
MSFlexGrid2.RowSel = MSFlexGrid1.RowSel
MSFlexGrid2.ColSel = MSFlexGrid1.ColSel
thx its works but i have another prob. when i scroll down flexgrid1 then select. the flexgrid2 doesn't scroll down/follow the item i selected
Of course not, you have to code everything in programming. So tell the second grid to scroll down upon the first grids scroll event. :D
Code:Private Sub MSFlexGrid1_Scroll()
MSFlexGrid2.TopRow = MSFlexGrid1.TopRow
End Sub
thx. is there a way to highlight the full row, because the first column is not highlighted
:)Code:Option Explicit
Private Sub MSFlexGrid1_Click()
'Select the starting column
MSFlexGrid1.Col = 0
'Select the end column
MSFlexGrid1.ColSel = MSFlexGrid1.Cols - 1
'Select the second grids row
MSFlexGrid2.Col = MSFlexGrid1.Col
MSFlexGrid2.Row = MSFlexGrid1.Row
MSFlexGrid2.RowSel = MSFlexGrid1.RowSel
MSFlexGrid2.ColSel = MSFlexGrid1.ColSel
End Sub
Private Sub MSFlexGrid1_Scroll()
MSFlexGrid2.TopRow = MSFlexGrid1.TopRow
End Sub