Turning off and on blue highlight bar on selected row of datagridview

I have a datagridview that I want to look like a cash register tape.  So I dont want the blue highlight bar over any of the rows.  I was able to get rid of it with the following code,
 Private Sub dgItems_SelectionChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles dgItems.SelectionChanged
        If dgItems.SelectedRows.Count > 0 Then
            dgItems.SelectedRows(0).Selected = False
        End If
    End Sub

However when someone clicks on a row of the datagridview I want to turn it back on so we can seel the selected item.  Tried a few things in the cell.click and cellcontent.click, but to no avail.  Thanks in advance for the help

Private Sub dgItems_CellClick(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles dgItems.CellClick
        Dim i As Integer = e.RowIndex
        dgItems.Rows(i).Selected = True
    End Sub
mgmhicksAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
nepaluzConnect With a Mentor Commented:
set the focus to another item on the form (either during Form_Load or after populating / databinding  the grid)
0
 
nepaluzCommented:
have you tried setting the SelectionMode to FullRowSelect? Do this in the properties of the datagridview and see what it throw up!
0
 
mgmhicksAuthor Commented:
Yes, it is set to fullrowselected.  

0
 
John (Yiannis) ToutountzoglouInstructor Multiengine PilotCommented:
Hi...You may play with the DefaultCellStyle..
When The datagridview is loaded set the Selection BackColor and SelectionForeColor the same as the DadatagridView's Color's
Then In the Cell Click Event change these Colors and "Highlight" the selected Row..
Hope It Helps..
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.