Hi all i will have some data in my datagrid as follows
Now if i click on first column on any cell i would like to show a from, and if i click on 2nd row on any cell value i would like to show another form. How can i do this...
Hi all i will have some data in my datagrid as follows
Now if i click on first column on any cell i would like to show a from, and if i click on 2nd row on any cell value i would like to show another form. How can i do this...
You need to keep some value identifying form to launch in the data table (or in hidden column). Now, in click event, you can look up for that value within current row and launch the needed form.
I got the answer
private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
{
string s = dataGridView1.CurrentCell.RowIndex.ToString();
if (Convert.ToInt32(s) == 0)
{
Form f = new Form();
ActivateMdiChild(f);
f.Show();
}
if (Convert.ToInt32(s) == 1)
{
MessageBox.Show("Hi");
}
}