About mark a row in a DataGridView

  • Thread starter Thread starter Tony Johansson
  • Start date Start date
T

Tony Johansson

Hello!

I have a DataGridView of many rows mayby over 100.
To this DataGridView is a DataTable connected like this
bindingSource.DataSource = _dataTable;
dgvStock.DataSource = _bindingSource;
In this form is there also two text field where I can enter name or
productnumber
I have also a search button.
When I want to do a search I enter into the name field or the productnumber
field and then press the search button.

I loop through the DataTable after the given name or productnumber until
found or until end of DataTable.

Now to my question is there a way to mark the row in the DataGridView where
the name or productnumber was found.

//Tony
 
Hello!

I have a DataGridView of many rows mayby over 100.
To this DataGridView is a DataTable connected like this
bindingSource.DataSource = _dataTable;
dgvStock.DataSource = _bindingSource;
In this form is there also two text field where I can enter name or
productnumber
I have also a search  button.
When I want to do a search I enter into the name field or the productnumber
field and then press the search button.

I loop through the DataTable after the given name or productnumber until
found or until end of DataTable.

Now to my question is there a way to mark the row in the DataGridView where
the name or productnumber was found.

//Tony

Hi,

Just change the CSS of that row, or of that cell for that matter, you
could also add a A tag and navigate to it this will have the extra
effect of making that row visible
 
Hello!

I used this one it was easy it it works
dgStock.Rows.Selected = true;

//Tony
 
Back
Top