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());
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