Advertisement

01.03.2008 at 12:03PM PST, ID: 23056529
[x]
Attachment Details

checked or unchecked

Asked by joelilly in Visual Studio .NET 2005, Microsoft Visual Basic.Net, .NET Framework 2.0

Tags: Microsoft, VB.NET, 2005, dataGridView checkbox

My datagridview has checkbox columns, one for "Odd" and one for "Even".  When user checks Odd, I want to uncheck Even, because they can't both be checked.  I have 2 questions:

1. What event should I start with?
2. How do I determine whether user has checked on or off?

So far I've tried using the CellValueChanged and MouseClick events.  I'm trying to determine whether the user has checked or unchecked the box like this:

Dim ck As Boolean = CBool(datagridview.Rows((e.RowIndex)).Cells(e.ColumnIndex).Value)

With this, ck is always false.  Why?  Should I be catching this in another event?Start Free Trial
[+][-]01.03.2008 at 12:55PM PST, ID: 20576697

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Visual Studio .NET 2005, Microsoft Visual Basic.Net, .NET Framework 2.0
Tags: Microsoft, VB.NET, 2005, dataGridView checkbox
Sign Up Now!
Solution Provided By: VBRocks
Participating Experts: 2
Solution Grade: A
 
 
[+][-]01.03.2008 at 12:56PM PST, ID: 20576713

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01.04.2008 at 10:16AM PST, ID: 20584672

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628