Results 1 to 5 of 5

Thread: radiobutton question

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2007
    Posts
    403

    radiobutton question

    is it possible to bind 2 radiobuttons to 1 column in a table... like for example, i have 2 radiobuttons... one labeled male then the other one is female... now in my table i have a gender column... then i want to bind this column to these 2 radiobuttons so if in a record it says male on that column then radiobutton1 will be marked and vice versa....

    any suggestions?

    thanks...

    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,221

    Re: radiobutton question

    Presumably you mean you want to bind the Checked property of RadioButtons to the column. That doesn't really make sense because the Checked property is type Boolean but your column doesn't contain boolean values. You could derive your own class from RadioButton and declare a new property of the appropriate type to which you could bind your column.
    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: radiobutton question

    Quote Originally Posted by jmcilhinney
    Presumably you mean you want to bind the Checked property of RadioButtons to the column. That doesn't really make sense because the Checked property is type Boolean but your column doesn't contain boolean values. You could derive your own class from RadioButton and declare a new property of the appropriate type to which you could bind your column.
    oh i see... if for example i made my own class from RadioButton and added a Value Property for instance... i can bind 2 of them into only one column/field in my table?

    coz there's this other programming tool i used before that has a Radio Group Control which you can add several Radio Buttons under it... then each button has a Value Property where you put the data to be stored on the column/field of the database... and even though you have several buttons, since you can only click one, only the Value of that button will be send to the table.

    so im trying to do something like this in VB.Net...

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

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

    Re: radiobutton question

    You would define your own UserControl for that. You could add all the design-time support to allow you to change the number of selections at will, but that would be a bit of trouble. In your case I'd suggest just defining a UserControl with two static RadioButtons on it. You would then add whatever properties and other members were appropriate.
    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

  5. #5

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2007
    Posts
    403

    Re: radiobutton question

    ok... let me try doing that first...

    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