Highlighting text in DataGridView

S

sh

How can I highlight the text in a cell, as if it had been selected with
the mouse?

I have a validation routine that checks the data in each column. If a
cell fails the validation, I show a MessageBox with an error message. I
then want to highlight the bad data. But I can't seem to do that.

I don't want to change the background color, nor the foreground color. I
just want to highlight it as if it had been selected by mouse.

In a TextBox, there is SelectionStart and SelectionLength. Is there
something similar in a DataGridView?

Thanks in advance.
 
R

ronchese

..Net 2005:

DataGridView1.Rows(0).Cells(0).Style.BackColor = Color.Yellow

[]s

Cesar
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top