Angel02
asked on
selected rows in winform gridview
I have a gridview created in windows forms. I need to obtain the selected rows in the grid view, and clear the contents of column with index 3.
That is, the values of cells in column 3 in selected rows should be made "".
Should I use the SelectedRow property for this purpose? If yes, how?
That is, the values of cells in column 3 in selected rows should be made "".
Should I use the SelectedRow property for this purpose? If yes, how?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Perfect! Thanks a lot. This is what I needed.
private void TestButton_Click(object sender, EventArgs e)
{
foreach (DataGridViewRow row in testGrid.SelectedRows)
{
row.Cells[2].Value = string.Empty;
}
}
PS:
I think in Windows Forms its called DataGridView (System.Windows.Forms.Data GridView), and in web controls its called GridView (System.Web.UI.WebControls )
private void TestButton_Click(object sender, EventArgs e)
{
foreach (DataGridViewRow row in testGrid.SelectedRows)
{
row.Cells[2].Value = string.Empty;
}
}
PS:
I think in Windows Forms its called DataGridView (System.Windows.Forms.Data
Yep thats right about the names.
To make it even more confusing they have different names in earlier versions of the framework too!
To make it even more confusing they have different names in earlier versions of the framework too!
Do you mean a DataGridView rather than a Gridview?