Link to home
Start Free TrialLog in
Avatar of Angel02
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?
Avatar of daveamour
daveamour
Flag of United Kingdom of Great Britain and Northern Ireland image

Hi
Do you mean a DataGridView rather than a Gridview?
ASKER CERTIFIED SOLUTION
Avatar of daveamour
daveamour
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Angel02
Angel02

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.DataGridView), and in web controls its called GridView (System.Web.UI.WebControls)
Yep thats right about the names.
To make it even more confusing they have different names in earlier versions of the framework too!