?
Solved

Radio Button "yes/no" Binding WinForms

Posted on 2013-01-07
2
Medium Priority
?
648 Views
Last Modified: 2013-01-07
I am new to radio button binding.  I have the following controls on my form:
gbWeldFixPic - Group Box Control
rbWeldFixPicNo - Radio Button Control - in gbWeldFixPic
rbWeldFixPicYes - Radio Button Control - in gbWeldFixPic

I have a field in sql that stored the value as a bit (field name:  engord.weldfixpic)

When I open the form for an existing order.... if my bit value is 1 then I want the rbWeldFixPicYes = checked, if my bit value is 0 then I want the rbWeldFixPicNo = checked.

What is a good way to implement this?  Please provide a working code example.
0
Comment
Question by:ndornack
[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 42

Accepted Solution

by:
sedgwick earned 1000 total points
ID: 38750830
do it explicitly would be the easiest and fastest way to achieve what u want.
simply check the value of engord.weldfixpic, something like:

UpdateWeldFixPic(bool.Parse(engord.weldfixpic.ToString());

UpdateWeldFixPic(bool isWeldFixPic){
rbWeldFixPicYes.Checked = isWeldFixPic;
rbWeldFixPicNo.Checked = !isWeldFixPic;
}

Open in new window

0
 

Author Closing Comment

by:ndornack
ID: 38751621
I figured out a different way to do it, going along your thoughts though:

        private void rbWeldFixPicYes_CheckedChanged(object sender, EventArgs e)
        {
            if (rbWeldFixPicYes.Checked == true)
                newEngOrd.WeldFixPic = true;
            else
                newEngOrd.WeldFixPic = false;
        }

Thanks for your help
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Suggested Courses

764 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