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 Data Binding / May 2006

Tip: Looking for answers? Try searching our database.

Two ComboBox with same table

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
IT'Slop - 13 Mar 2006 15:30 GMT
Hi guy,
I have problem with databing. I have:
First table that rappresent the main transaction and a Second table that
rappresent the ports
of a voyage. I want to bind two combobox from two fields of the first table
and and a dataadapter
for the second table. At design time I have binded correctly the two
combobox, but at run time
when I change the value of the first combobox automaticly changes the
second.
But if I want Port of depart and Port of arrival?

Thanks for all
John - 15 Mar 2006 09:41 GMT
I'm having the exact same problem.  I have a single static array of values
that I use to bind to multiple combo boxes' DataSource propery.  At runtime,
changing the value of combo box changes them all.  The underlying
SelectedValue of each box keeps the proper value... just the display changes.

The only way around it I've found so far is to create a seperate identical
array for each box, but this is less-than efficient solution, and in
IT'Slop's problem, creating multiple tables just to feed a combo box would be
even worse.

> Hi guy,
> I have problem with databing. I have:
[quoted text clipped - 9 lines]
>
> Thanks for all
John - 15 Mar 2006 10:10 GMT
Oops... posted too soon.  Here are some fragments from my problem:

The array I'm using as my datasource:

       static public ListEntry[] BankAcctType_ValueList =
       {
           new ListEntry(" ", "No Account Specified"),
           new ListEntry("F", "Fed Routing Number (ABA)"),
           new ListEntry("D", "DDA Account Number"),
           new ListEntry("B", "Bank Identifier Code (BIC/SWIFT)"),
           new ListEntry("C", "CHIPS Participant"),
           new ListEntry("U", "CHIPS Identifier")
       };

ListEntry is pretty basic:

       public class ListEntry
       {
           private string strValue;
           private string strText;

           public ListEntry(string Value, string Text)
           {
               strValue = Value;
               strText = Text;
           }
           static public string Lookup(string Value, Array List) {...}
           public string Text {...}
           public string Value {...}
       }

My ComboBox bindings.  Each box is the same, except for the SelectedValue,
which I route to appropriate properties:

     cbxBBK_AcctType.DataSource =
WireTransfer.Message.BankAcctType_ValueList;
     cbxBBK_AcctType.DisplayMember = "Text";
     cbxBBK_AcctType.ValueMember = "Value";
     cbxBBK_AcctType.DataBindings.Add("SelectedValue", bsWire,
"BBK_AcctType");

> Hi guy,
> I have problem with databing. I have:
[quoted text clipped - 9 lines]
>
> Thanks for all
theftum - 11 May 2006 15:03 GMT
I have experienced a similar issue but in my case I am using strongly typed
object collections. The issue can be got around by using a different Binding
Source for each control, for example:

           bsMembers.DataSource = BL_MemberRootCollection.Singleton;
           bsMembers2.DataSource = BL_MemberRootCollection.Singleton;
           
           cmbOwner.DataSource = bsMembers;
           cmbOwner.DisplayMember = "MemberName";
           cmbOwner.ValueMember = "MemberId";

           colMemberName.DataSource = bsMembers2;
           colMemberName.DisplayMember = "MemberName";
           colMemberName.ValueMember = "MemberID";

Previously both controls were using the same bindingsource.

> Oops... posted too soon.  Here are some fragments from my problem:
>
[quoted text clipped - 50 lines]
> >
> > Thanks for all

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.