Solved

CheckBox - How do I show my Three State checkbox to show the NULL state as a string value?

Posted on 2008-06-20
2
392 Views
Last Modified: 2011-10-03
I want to use a checkbox that informs the user that the NULL value is "Unknown". I know the code to show that "Yes" if the checkbox is true & "No" if false but how would I code the NULL value in my table to show "Unknown"? Is this possible? I am using a Visual Basic form and SQL database. The datatype is set to a BIT.
Private Sub LicenceAgreeCheckBox_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox.CheckedChanged
        If CheckBox.Checked = True Then
            CheckBox.Text = "Yes"
        Else
            CheckBox.Text = "No"
        End If
    End Sub

Open in new window

0
Comment
Question by:teustace
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 18

Accepted Solution

by:
jcoehoorn earned 50 total points
ID: 21830678
Use the CheckState property:
Private Sub LicenceAgreeCheckBox_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox.CheckedChanged
    Select Case CheckBox.CheckState
        Case CheckState.Checked
            CheckBox.Checked = "True"
        Case CheckState.Indeterminate
            CheckBox.Checked = "Unknown"
        Case CheckState.Unchecked
            CheckBox.Checked = "False"
    End Select
End Sub

Open in new window

0
 

Author Closing Comment

by:teustace
ID: 31469115
Hi Jcoehoorn, Many thanks! Works a treat and I can use this for other things....
0

Featured Post

[Webinar] Learn How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…

627 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question