0

hi,
i am creating a project in C#.NET 2008 standard edition. how can i make the datagrid view read only, but when a cell is clicked which has data another from should open.
how can i do this
thanks

3
Contributors
3
Replies
4
Views
7 Years
Discussion Span
Last Post by manoj kumar1446
1

Set "AllowUserToAddRows" and "AllowUserToDeleteRows" to "False" and "EditMode" to "EditProgrammatically" to make it read only.

Add "CellClick" event and use this code:

private void DGV_CellClick(object sender, DataGridViewCellEventArgs e)
{
        if (dataGridView.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString() != string.Empty)
                form2.Show();
}

Thanks

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.