Results 1 to 3 of 3

Thread: checkbox custom true and false value

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2007
    Posts
    403

    checkbox custom true and false value

    hi all,

    i have a checkbox bound to a column with datatype character to my database... the column uses values Y and N.

    also, just like to add that i have tried changing the column into character of 5 byte so that it can hold the values "True" and "False" when the property bound is the property Checked. this works okay but there are some columns that doesn't use True and False like in my statement above.

    is there a way that i can set my checkbox to checked when the column value it is bound to is Y and vice versa.. i noticed that in the checkbox inside a datagridview has the properties TrueValue and FalseValue but i dont see this anywhere in the checkbox not in the datagridview.

    thanks.
    Last edited by adshocker; Mar 18th, 2009 at 11:38 PM.

    VB Version: Microsoft Visual Studio 2008 Professional Edition
    .NET Version: Microsoft .NET Framework Version 3.5
    OS: Windows XP SP3

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,222

    Re: checkbox custom true and false value

    You can't use a regular CheckBox. Inherit the CheckBox class and add your own property that will get and set the Checked property based on "Y"c and "N"c values. You can then bind to that property.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2007
    Posts
    403

    Re: checkbox custom true and false value

    thanks... will try it out.

    VB Version: Microsoft Visual Studio 2008 Professional Edition
    .NET Version: Microsoft .NET Framework Version 3.5
    OS: Windows XP SP3

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width