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

  • Home
  • SEARCH
  • 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 6729115
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T10:15:02+00:00 2026-05-26T10:15:02+00:00

I have a problem with data binding my user control into a DGV. When

  • 0

I have a problem with data binding my user control into a DGV. When I bind into only 1 textbox of my control, it works. However when I bind more than 1 textbox, only the first works. Please help. I am a C# beginner. Below is the code.

  • I created Window Form app (named Test100)
  • I added a user control “MyBox” into the project Test100, I added 2 textboxes into it (textBox1 and textBox2)
  • In the MyBox.cs, I have the following:

    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Drawing;
    using System.Data;
    using System.Linq;
    using System.Text;
    using System.Windows.Forms;
    namespace Test100
    public partial class MyBox : UserControl
    {
        public string Box1
        {
            get
            {
                return textBox1.Text;
            }
            set
            {
                textBox1.Text = value;
            }
        }
    
        public string Box2
        {
            get
            {
                return textBox2.Text;
            }
            set
            {
                textBox2.Text = value;
            }
        }
        public MyBox()
        {
            InitializeComponent();
        }
    }
    
  • After building, I opened my Form 1 and: added the MyBox control into my Form1, added a DGV into Form 1, added a button for refreshing the Form. The data list is produced directly in the Form1.cs. The Form1.cs is listed below:

    public partial class Form1 : Form
    {
        private List<Track> trackList = new List<Track>();
        public Form1()
        {
            InitializeComponent();
        }
    
        private void Form1_Load(object sender, EventArgs e)
        {
            trackList.Add(new Track
            {
                TrackID = 1234,
                Name = "Name1111"
            });
            trackList.Add(new Track
            {
                TrackID = 5678,
                Name = "Name2222"
            });
            trackList.Add(new Track
            {
                TrackID = 9012,
                Name = "Name333"
            });
            BindingSource bindingSource1 = new BindingSource();
            bindingSource1.DataSource = trackList;
            dataGridView1.DataSource = bindingSource1;
    
            myBox1.DataBindings.Add("Box1", dataGridView1.DataSource, "TrackID");
            myBox1.DataBindings.Add("Box2", dataGridView1.DataSource, "Name");
    
        }
    
        private void button1_Click(object sender, EventArgs e)
        {
            this.Refresh();
        }
    }
    public class Track
    {
        public int TrackID { get; set; }
        public string Name { get; set; }
    } 
    
  • After start debugging, I changed the Box1 value and pushed the button1, the TrackID on the DGV changed with the value I changed. However, when I changed the value of Box2 and pushed the button1, the Name column on DGV did not change but the Box2 returned to the original value.

  • If I bind only the Box2, then Box2 will work.

Please help. Thanks.

  • 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-26T10:15:03+00:00Added an answer on May 26, 2026 at 10:15 am

    Okay. Never mind. I found that this is a known issue that MS recognized from 2004 and fixed in .Net 1.1.
    http://support.microsoft.com/kb/812918
    However I am using VS 2010 and doing Winform, I tried to apply the fix that MS fixed for this issue and it works. Thank you for reading.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a problem with binding data using BindingSource, typed dataset and DataGridView. My
i have problem to correctly bind data to WPF Chart. When i'm setting ItemsSource
I have a problem with a data-bound DataGrid control, in that despite each column
I have the following problem in wpf: I have defined a user control (in
I have a data navigation user control in Silverlight which opens a child window
I'm trying to perform two-way data binding on the controls in my user control,
I have run into a problem w/ my model for databinding in WPF. I
I have a problem returning data back to the function I want it returned
I have a problem POSTing data via HTTPS in Java. The server response is
I have a problem with data in UITableView. I have UIViewController, that contains UITableView

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.