Below is some code I have that isn't highlighting the row everytime. I don't know why. I want to highlight the row the user clicks on. I don't have the selectionmode set to row because I need to allow the users to double click on individual cells for data input.
Any help is very much appreciated.
Private Sub MSFlexGrid1_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
Dim lIndex As Long
Dim lRow As Long
Dim CurrBackColor As Variant
Dim NewBackColor As Variant
Dim NewForeColor As Variant
With MSFlexGrid1
lRow = .RowSel
.Row = lRow
If lRow <> 0 Then
.Visible = False
.Col = 0: CurrBackColor = .CellBackColor
If CurrBackColor <> vbWindowBackground Then
NewBackColor = vbWindowBackground
NewForeColor = vbWindowText
Else
NewBackColor = vbHighlight
NewForeColor = vbWhite
End If
For lIndex = 0 To .Cols - 1
.Col = lIndex: .CellBackColor = NewBackColor: .CellForeColor = NewForeColor
Next
.Visible = True
End If
End With
Any help is very much appreciated.
Private Sub MSFlexGrid1_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
Dim lIndex As Long
Dim lRow As Long
Dim CurrBackColor As Variant
Dim NewBackColor As Variant
Dim NewForeColor As Variant
With MSFlexGrid1
lRow = .RowSel
.Row = lRow
If lRow <> 0 Then
.Visible = False
.Col = 0: CurrBackColor = .CellBackColor
If CurrBackColor <> vbWindowBackground Then
NewBackColor = vbWindowBackground
NewForeColor = vbWindowText
Else
NewBackColor = vbHighlight
NewForeColor = vbWhite
End If
For lIndex = 0 To .Cols - 1
.Col = lIndex: .CellBackColor = NewBackColor: .CellForeColor = NewForeColor
Next
.Visible = True
End If
End With