dotnetspider.com
Login Login    Register      

TutorialsForumCareer DevelopmentResourcesReviewsJobsInterviewCommunitiesProjectsTraining

Subscribe to Subscribers
Talk to Webmaster
Tony John

Facebook
Google+
Twitter
LinkedIn
Online MembersGaurav Arora
More...
Join our online Google+ community for Bloggers, Content Writers and Webmasters




Forums » .NET » Windows »

Check box enable true or false in datagrid view of windows application


Posted Date: 27 Jun 2012      Posted By:: divya     Member Level: Silver    Member Rank: 838     Points: 5   Responses: 1



I have data grid in windows application as mentioned below

ID Name Check1 Check2 Check3
AB0001 John False True False
AB2461 Thomas False True False
AB0002 Steve False False True
AB0010 Robert False False True
AB2467 Robert False False True
in the above grid check1,2,3 are the check boxes,In this for each user i need to select only one check box.
Note:
If I selected Check1 for user1 then i need to disable check2 and check3 for this user.How can i do this in windows application




Responses

#677865    Author: sudhajosyula      Member Level: Gold      Member Rank: 46     Date: 28/Jun/2012   Rating: 2 out of 52 out of 5     Points: 4

Hi divya,
Use the below code and let me know if you encounter any errors or you if you stuck up...

protected void dataGridView1_CellValueChanged(object sender, DataGridViewCellEventArgs e)
{
if (e.ColumnIndex == 2)
{
bool isChecked = (Boolean) dataGridView1[2, e.RowIndex].FormattedValue;
if(isChecked == true)
{
dataGridView1[3, e.RowIndex].Value = false;
dataGridView1[4, e.RowIndex].Value = false;
}
if(isChecked == false)
{
dataGridView1[3, e.RowIndex].Value = true;
dataGridView1[4, e.RowIndex].Value = true;
}
}
}




 
Post Reply

 This thread is locked for new responses. Please post your comments and questions as a separate thread.
If required, refer to the URL of this page in your new post.



Next : How to Publish console application
Previous : Change the data in grid with cellcontentclick event
Return to Discussion Forum
Post New Message
Category:

Related Messages



Follow us on Twitter: https://twitter.com/dotnetspider

Active Members
TodayLast 7 Daysmore...

Awards & Gifts
Email subscription
  • .NET Jobs
  • .NET Articles
  • .NET Forums
  • Articles Rss Feeds
    Forum Rss Feeds


    About Us    Contact Us    Copyright    Privacy Policy    Terms Of Use    Revenue Sharing sites   Advertise   Talk to Tony John
    Copyright © SpiderWorks Technologies Pvt Ltd., Kochi, India
    2005 - 2012 All Rights Reserved.
    .NET and other trademarks mentioned in this site belong to Microsoft and other respective trademark owners.
    Articles, tutorials and all other content offered here is for educational purpose only.
    We are not associated with Microsoft or its partners.