Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm Controls / January 2006

Tip: Looking for answers? Try searching our database.

Bound combobox not Updating DataSet

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
John Faris - 23 Jan 2006 14:10 GMT
I have a combobox with its DataSource set to a DataSet, "dsStatus", that is
filled from a dataadaptor.  The DisplayMember property is set to the name of
a DataTable and a column name i.e. "StatusTable.Status".  Similarily, the
ValueMember is set to the name of the DataTable and another column name i.e.
"StatusTable.StatusId".  This gives me a working combobox that correctly
lists a selection of Status values returned by the dataadaptor.

However, I have also bound the combo's SelectedValue property to a different
DataSet, DataTable, Column name combination.  This is because I want to use
the first DataSet as a lookup to set values in the second DataSet.  This
seems to work and does not error, but I also have a grid bound to the second
DataSet and it does not update when I change the selected value of the
combobox.  It seems as if the Combobox does not update the DataSet or it
does not cause the other controls to be notified that the dataset has
changed.  Is this a known problem or have I missed something?

TIA.

John.
Bart Mermuys - 23 Jan 2006 15:11 GMT
Hi,

>I have a combobox with its DataSource set to a DataSet, "dsStatus", that is
>filled from a dataadaptor.  The DisplayMember property is set to the name
[quoted text clipped - 12 lines]
> that the dataset has changed.  Is this a known problem or have I missed
> something?

If you change the ComboBox and then go to the DataGrid and click on a
different row, do you see the update then (inside the grid) ? If so, then
this is normal, the Control's aren't notified until
CurrencyManager.EndCurrentEdit() is called or until you change current row
(which implicitly calls EndCurrentEdit())..

If you need instant change, you could use:

private void ComboBox_SelectedIndexChanged(...)
{
   BindingContext[ds, "mastertable"].EndCurrentEdit();
}

but then you can't cancel edit anymore.

HTH,
Greetings

> TIA.
>
> John.
John Faris - 23 Jan 2006 15:32 GMT
> If you change the ComboBox and then go to the DataGrid and click on a
> different row, do you see the update then (inside the grid) ? If so, then
> this is normal, the Control's aren't notified until
> CurrencyManager.EndCurrentEdit() is called or until you change current row
> (which implicitly calls EndCurrentEdit())..

That's exactly what happens, thanks for pointing that out, I hadn't noticed
this!

> If you need instant change, you could use:
>
> private void ComboBox_SelectedIndexChanged(...)
> {
>    BindingContext[ds, "mastertable"].EndCurrentEdit();
> }

Great, thanks again for your help today!

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.