473,396 Members | 1,895 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Unable to set DataGridViewCheckboxCell to Checked in DataGridView in a TabControl

Hi all...

This is a good one. You'll like this...

I am working on a course management tool that allows certain Courses
to be cross referenced with Job Roles and, when they are, whether the
course is a priority course or not. Simple.

Because there is alot of data stored for each course, I am using a tab
control with several pages. The Job Role cross-referencing comes on
tab 7 of the Tab control.

I get a list of all available Job Roles and put them into the
DataGridView.

Then I get a DataTable of all existing Job Role cross references and
if their associated "Is Priority" flag (true or false).

Once I have this cross reference list, I cycle through all the rows im
my Job Role cross reference table and, for each one, I check all the
rows in my DataGridView's rows.

If the ID of the Job Role in the DataTable Row matches the Job Role ID
in the DataGridView Row, then I set the Value of the
DataGridViewCheckBoxCell to True. If it is a match, I also check if
its a priority course and set that to it's "Is Priority" flag status.

Now. Heres the good part. I was mucking about with this for hours
today because no matter what I did, I couldn't get the checkboxes to
'check' in the DataGridView. So I decided to build a test form and cut
all the code out I didn't need to see if something was interfering,
and I got it to work!
I went back to my original code and copied all the code from the test
form and tested it, and guess what... it failed?!

Hmm. As I'd cut back for testing the process, I hadn't put the
DataGridView in a Tab Control. So I thought I'd go back to my test
form and put the DataGridView there in a new Tab Control and it still
worked! Grrr

Enough is enough I thought, so I created several more tabs on my Test
Form's Tab Control, and moved the DataGridView to the 7th Tab and
BANG! It failed! I moved the DataGridView about and discovered that it
will only work on the first tab!

So my question is this...how do I get them to work on any other tabs
than the first one?

This is in VB.net 2005 by the way. Data is in SQL Server 2005 DB.

If anyone would like to have a go at this and requires a sample
solution, please let me know.

Aug 7 '07 #1
1 7751
On 7 Aug, 19:46, Karl <googlegro...@cortexa.co.ukwrote:
Hi all...

This is a good one. You'll like this...

I am working on a course management tool that allows certain Courses
to be cross referenced with Job Roles and, when they are, whether the
course is a priority course or not. Simple.

Because there is alot of data stored for each course, I am using a tab
control with several pages. The Job Role cross-referencing comes on
tab 7 of the Tab control.

I get a list of all available Job Roles and put them into the
DataGridView.

Then I get a DataTable of all existing Job Role cross references and
if their associated "Is Priority" flag (true or false).

Once I have this cross reference list, I cycle through all the rows im
my Job Role cross reference table and, for each one, I check all the
rows in my DataGridView's rows.

If the ID of the Job Role in the DataTable Row matches the Job Role ID
in the DataGridView Row, then I set the Value of the
DataGridViewCheckBoxCell to True. If it is a match, I also check if
its a priority course and set that to it's "Is Priority" flag status.

Now. Heres the good part. I was mucking about with this for hours
today because no matter what I did, I couldn't get the checkboxes to
'check' in the DataGridView. So I decided to build a test form and cut
all the code out I didn't need to see if something was interfering,
and I got it to work!
I went back to my original code and copied all the code from the test
form and tested it, and guess what... it failed?!

Hmm. As I'd cut back for testing the process, I hadn't put the
DataGridView in a Tab Control. So I thought I'd go back to my test
form and put the DataGridView there in a new Tab Control and it still
worked! Grrr

Enough is enough I thought, so I created several more tabs on my Test
Form's Tab Control, and moved the DataGridView to the 7th Tab and
BANG! It failed! I moved the DataGridView about and discovered that it
will only work on the first tab!

So my question is this...how do I get them to work on any other tabs
than the first one?

This is in VB.net 2005 by the way. Data is in SQL Server 2005 DB.

If anyone would like to have a go at this and requires a sample
solution, please let me know.
I still haven't worked out why this was doing what it was doing...

The only workaround that I've found that works so far is to get my
data with the linked and priority values already attached to the
original query (use two queries - one with the relevant cross
referenced data and union to one were no cross reference exists),
then, instead of using my data as a datasource for the DataGridView, I
added columns of the right type (DataGridViewTextBoxColumn and
DataGridViewCheckBoxColumn) and then looped through the DataTable
adding the rows one by one. As I dont have too many rows this is such
a problem, but I can easily imagine it becoming a performance issue if
there were alot of data to add...

If anyone can think of a better way, please let me know...

Aug 10 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Stropher | last post by:
I have the following: this.dataGridViewBill.DataSource = tblResult; //hide the following columns this.dataGridViewBill.Columns.Visible = false; //email this.dataGridViewBill.Columns.Visible =...
0
by: Michael A. Covington | last post by:
Is there a way to put the same DataGridView in 2 different places (on 2 different tabs of a TabControl)? I want to change the visibility of the columns and the width of some of them depending on...
10
by: Crazy Cat | last post by:
Hi, I am dynamically creating datagridviews for my application, then filling them with data from a 30 row datatable, and everything seems to work great with one exception. My horizontal...
2
by: Karen Hill | last post by:
I have a datagridview control on a form with a few of the columns being DataGridViewCheckBox. Whenever I click on the checkbox to create a new record I get a NullReference Exception thrown even...
4
by: Annie | last post by:
hello guys, I am having a DataGridView control. The first column is a checkbox column. The users can select the checkbox column. I need to loop through the grid rows and get the checked...
1
by: zlf | last post by:
Hi, After setting DataGridViewCheckBoxColumn's TrueValue and FalseValue, I found I assign either TrueValue or FalseValue to a DataGridViewCheckBoxCell, it will be checked. What is the problem? How...
3
by: sankarpulivarthi | last post by:
Hi i have a checkbox in first datagridview . when it is checked it should get that row values.and iam trying to display that checked row values in a second datagridview after clicking a button....
1
by: jcasti1226 | last post by:
Hi guys, This may be a dumb but it has given me a lot of problems. Here is my situation:
1
by: Jeff | last post by:
Hey ..NET 2.0 I've created a User Control which contain a DataGridView. This User Control is displayed on a TabPage. This TabPage is added to the TabControl during runtime. The problem is...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.