In my datagridview, i got 4 columns and a textbox to search. I have loaded 4 col names in the combo-box list when the user choose the column name and type something in the textbox,
I want to pointout the row in the datagird and display it to the display model.
I have function DisplaySelectedProjection, when the user choose any row i the datagirdview the values of the selected row displayed in the textboxes of the corresponding one.
private void textBox2_TextChanged(object sender, EventArgs e)
{
}
private void comboBox2_SelectedIndexChanged(object sender, EventArgs e)
{
}
private void DataGridDepthProjection_SelectionChanged(object sender, EventArgs e)
{
DisplaySelectedProjection();
}
private void DisplaySelectedProjection()
{
if (DataGridDepthProjection.CurrentRow == null)
return;
var index = DataGridDepthProjection.CurrentRow.Index;
if (index < 0 || index >= bindingList.Count)
return;
var item = bindingList[index];
var depthProjection = depthProjections[item];
Display(depthProjection);
}
You need to loop through the DataGridView rows and cells to match the criteria. For this, you need to use:
In the DataGridView’s RowChanging event, you need to change the color of the cell.