Hello, I have created small program with one button "OK" and "DataGridVew1" with one column "Messages", for storing text messages. When I start the program , i enter some messages to "DataGridView1" and when I click "OK Button" ,MessageBox shows with text of textmessage in first row. For unswering to your question look this sample code:
void Button1Click(object sender, EventArgs e)
{
// TODO: Implement Button1Click
//
// when you click on button OK,
// program shows MessageBox with value of
// DataGridView1[0,0]
// in this programming language column goes first then row!
// DataGridView[column,row], so watch out for mistakes,
// allso in some programming languages the first row and column
// does not have indexes [0,0] but [1,1]
int row = 0;
int column = 0;
string message;
//
// first and allways
// check is there any value in dataGridView1
// beacouse null value can sometimes make problem
//
if (dataGridView1\[column,row\].Value == null)
{
dataGridView1\[column,row\].Value = "Empty";
}
message = dataGridView1\[column,row\].Value.ToString();
MessageBox.Show(message);
}
I think that the answer to your question is obvious. All the best, Peric Zeljko periczeljkosmederevo@yahoo.com