Visit

Friday, August 5, 2011

Get or Set Value of Selected Field in DataGridView in C Sharp (C#) WinForms


Get or Set Value of Selected Field in DataGridView using C Sharp (C#) WinForms.

1. Get Value of Selected Field in DataGridView.
in this example i am using a MessageBox to Show the selected fields value.

MessageBox.Show(dataGridView1.CurrentCell.Value.ToString());

1. Set Value to Selected Field in DataGridView.
You can set both string and int to the field.


// setting string value
dataGridView1.CurrentCell.Value = 101;

// setting string value
dataGridView1.CurrentCell.Value = "C Sharp-Language";


Check out the code and do comment here...

No comments:

Post a Comment