selected row is not visually selected

guysl

New member
Joined
Aug 2, 2008
Messages
2
Programming Experience
5-10
Hello all,

When I use the code:
DataGridView1.Rows(i).Selected = True

I do not see on the screen that the row is indeed selected,
like when I manually click over a row - and then it is marked with dark gray color.
How can I have the same behaviour via the program?

Thanks,
Guy S.
 
Using VS2005 SP1 the row is visually selected.

VB.NET:
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) _
    Handles MyBase.Load
        Me.myTableAdapter.Fill(Me.myDataSet.TableName)

        DataGridView1.RowsDefaultCellStyle.SelectionBackColor = Color.DarkGray

        DataGridView1.Rows(0).Cells(0).Selected = False

        DataGridView1.Rows(2).Selected = True
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) _
    Handles Button1.Click
        DataGridView1.Rows(2).Selected = False
        DataGridView1.Rows(0).Selected = True
    End Sub
 
Back
Top