Question

I need to have this event for my cursor interacting with my textbox IN A GRIDVIEW. I tried using TextBox1_MouseEnter or any sort but IntelliSense can't help me. Am I missing a namespace? I have NO IDEA where to start to control mouse events.

Was it helpful?

Solution

There is no event on Gridview TextBox1_MouseEnter instead try this code.

private void dataGridView1_CellEnter(object sender, DataGridViewCellEventArgs e)
{
    dataGridView1[e.ColumnIndex, e.RowIndex].Style.SelectionBackColor = Color.Blue;
}

private void dataGridView1_CellLeave(object sender, DataGridViewCellEventArgs e)
{
    dataGridView1[e.ColumnIndex, e.RowIndex].Style.SelectionBackColor = Color.Empty;
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top