Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7166831
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T14:28:37+00:00 2026-05-28T14:28:37+00:00

I use VS2010 and then drag and drop Member datagridview to design view. After

  • 0

I use VS2010 and then drag and drop Member datagridview to design view.
After that I drag and drop name member textfield to design view and then try to edit and save. It’s work properly.

And then I drag and drop sex radio button to design view. But binding it does’t work.

How can I binding in this situation?

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Test7
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void memberBindingNavigatorSaveItem_Click(object sender, EventArgs e)
        {
            this.Validate();
            this.memberBindingSource.EndEdit();
            this.tableAdapterManager.UpdateAll(this.dbDataSet);

        }

        private void Form1_Load(object sender, EventArgs e)
        {
            // TODO: This line of code loads data into the 'dbDataSet.Member' table. You can move, or remove it, as needed.
            this.memberTableAdapter.Fill(this.dbDataSet.Member);
            // TODO: This line of code loads data into the 'dbDataSet.Member' table. You can move, or remove it, as needed.
            this.memberTableAdapter.Fill(this.dbDataSet.Member);

        }


        private void memberBindingNavigatorSaveItem_Click_1(object sender, EventArgs e)
        {
            this.Validate();
            this.memberBindingSource.EndEdit();
            this.tableAdapterManager.UpdateAll(this.dbDataSet);

        }
    }
}

enter image description here

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T14:28:37+00:00Added an answer on May 28, 2026 at 2:28 pm

    Here are two possible solutions.


    Binding Format and Parse events

    The Binding class has a built-in facility for on-the-fly transformations of bound data in the form of the Format and Parse events.

    Here’s how you would use those events with just the “Male” radiobutton. Create the binding in code, not in the designer:

    // create binding between "Sex" property and RadioButton.Checked property
    var maleBinding = new Binding("Checked", bindingSource1, "Sex");
    // when Formatting (reading from datasource), return true for M, else false
    maleBinding.Format += (s, args) => args.Value = ((string)args.Value) == "M";
    // when Parsing (writing to datasource), return "M" for true, else "F"
    maleBinding.Parse += (s, args) => args.Value = (bool)args.Value ? "M" : "F";
    // add the binding
    maleRb.DataBindings.Add(maleBinding);
    
    // you don't need to bind the Female radiobutton, just make it do the opposite
    // of Male by handling the CheckedChanged event on Male:
    maleRb.CheckedChanged += (s, args) => femaleRb.Checked = !maleRb.Checked;
    

    Computed Property

    Another approach is to add a computed property to your datasource:

    public bool IsMale
    { 
        get { return Sex == "M"; }
        set 
        {  
            if (value)
                Sex = "M";
            else
                Sex = "F";
        }
    }
    

    Now you can simply bind the Male radiobutton to this property on your datasource (just don’t show this property in the grid).

    And again you can hook up Female to Male like so:

    maleRb.CheckedChanged += (s, args) => femaleRb.Checked = !maleRb.Checked;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using VS2010. The projects that I'm working on use different source control providers,
I have a multi-threaded Win32 service written in C++ (VS2010) that makes extensive use
I have configured my website from VS2010 to use IIS 7.5. Then I added
VS2010 I have a structure that has a unique_ptr inside. I then have a
I use VS2010, C# to develop Silverlight 4 app, I use following code in
I use VS2010, C#, ASP.NET; I read some data from SQL server and fill
I use VS2010, C# to develop ASP.NET web app, I create some sessions in
Can you use Ninject 2.0 with VS2010 RC1?
Is there a way to use the SQL Model (dbml) builder in VS2010 using
I'm using VS2010,C# to develop a Silverlight online game, I use keyboard for getting

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.