We're a community of 1076K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,075,913 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

how can i make the datagrid view read only

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
1 Day
Discussion Span
3 Years Ago
Last Updated
4
Views
Question
Answered
krishnisilva
Junior Poster
122 posts since Apr 2010
Reputation Points: 10
Solved Threads: 4
Skill Endorsements: 0

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

farooqaaa
Posting Whiz in Training
295 posts since Jul 2008
Reputation Points: 61
Solved Threads: 71
Skill Endorsements: 0
Question Answered as of 3 Years Ago by farooqaaa

i am making a cricket website i want that while updating a team in my website i want to see image of particular team

manoj kumar1446
Newbie Poster
2 posts since May 2010
Reputation Points: 9
Solved Threads: 0
Skill Endorsements: 0

how can i insert a IP address in sql table

manoj kumar1446
Newbie Poster
2 posts since May 2010
Reputation Points: 9
Solved Threads: 0
Skill Endorsements: 0

This question has already been solved: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
 
© 2013 DaniWeb® LLC
Page rendered in 0.1325 seconds using 2.63MB