|
-
Dec 31st, 2002, 04:18 AM
#1
Thread Starter
Addicted Member
Highlight whole row
I have a Flexgrid in my form I am trying to highlight the whole row when I click the right mouse button, but it is not working with me..
This is the code I am using:
VB Code:
Private Sub msflexgrid1_MouseDown(Button As Integer,
Shift As Integer, X As Single, Y As Single)
If Button = vbRightButton Then
msflexgrid1.Col = 1
msflexgrid1.ColSel = msflexgrid1.Cols - 1
End if
End sub
Any suggestion??
Thanks in advance
-
Dec 31st, 2002, 04:22 AM
#2
Frenzied Member
There is an option called "FullRowSelect" (for the flexgrid)
Set that to TRUE.
-
Dec 31st, 2002, 04:32 AM
#3
Thread Starter
Addicted Member
There is an option called "FullRowSelect" (for the flexgrid)
Set that to TRUE.
Where is that exactly I didn't find it in the properties of the MSFLEXGRID!!!
-
Dec 31st, 2002, 05:07 AM
#4
Frenzied Member
Apologies thats for a ListView.
You should have n option called "Selection Mode", if you right click the flexgrid. Setting that to "By Row" should solve your problem.
-
Dec 31st, 2002, 05:16 AM
#5
Thread Starter
Addicted Member
It is already set for by row..
It is very strange it is working with left mouse click but not with right mouse click code
I am populating data from access database to the flex grid and using in my form_load function:
VB Code:
With mfgList
.Col = 1
.ColSel = .Cols - 1
End With
Does that effects???
-
Dec 31st, 2002, 05:32 AM
#6
Frenzied Member
Ah I see now ... sorry I wasn't reading it properly.
Assuming you have a header row, the following should work for you :
VB Code:
If Button = vbRightButton Then
msflexgrid1.Row = msflexgrid1.Row - 1
msflexgrid1.Col = 1
msflexgrid1.ColSel = msflexgrid1.Cols - 1
End If
-
Dec 31st, 2002, 06:56 AM
#7
Thread Starter
Addicted Member
It is not working exactly!!!
What happen that when I highlight the 2nd row by clicking left mouse button and go to row number 9 and click the right mouse button on row 9 the highlight jumps from row 2 to row 1???
Very weired??
-
Dec 31st, 2002, 10:00 AM
#8
Frenzied Member
VB Code:
If Button = vbRightButton Then
msflexgrid1.Row = msflexgrid1.MouseRow
msflexgrid1.Col = 1
msflexgrid1.ColSel = msflexgrid1.Cols - 1
End If
-
Jan 1st, 2003, 04:05 AM
#9
Thread Starter
Addicted Member
But if my MSFlexgrid doesn't contain any records, can i disable the mouse_click event on the Flexgrid because when there is no records in the flexgrid and I click on it it produce an error??
Thanks
-
Jan 1st, 2003, 12:02 PM
#10
Frenzied Member
You could set the flexgrids Enabled property = False, or in the mouse event, first test for records, if none simply exit the sub, if there are records then execute the highlight code.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|