Currency Manager with Grid and Form Views

  • Thread starter Thread starter C Glenn
  • Start date Start date
C

C Glenn

I have both a DataGrid and collection of data editing controls within a
form connected to the same table within the same DataSet with a
CurrencyManager. But they don't remain in sync with one another. I
expected that when I moved the row pointer within the grid that the
controls would point to the same row. But changing row within the grid
does not automatically change the CurrencyManager.Position.

How do you handle this?
 
C Glenn,

Can you show how you are binding to the table in the grid and in the
controls? You have to bind to the same object, with the same path.

So, if in the grid you bound directly to the data table, and in the
controls you bound to the data set with the member set to the data table's
name, those are considered separate data sources. This will throw off your
binding.

Hope this helps.
 
I'm stunned! Is there a concise but complete resource on these details?
The individual controls are bound like this:
txtTask.DataBindings.Add(new System.Windows.Forms.Binding( "Text",
dsCTasks, "Tasks.uidTask"));

I was doing this with the DataGrid:
dgTA.DataSource = dsCTasks.dtTasks;
(dtTasks was created like this: dtTasks = new DataTable("Tasks");)

I've just switched to this:
dgTA.DataSource = dsCTasks;
dgTA.DataMember = "Tasks";

Now the two are talking to the same CurrencyManager. Thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top