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 General / January 2007

Tip: Looking for answers? Try searching our database.

dynamic bound controls

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Hergass - 30 Jan 2007 08:08 GMT
Hi
I try to create a few dynamic bound combobox controls, but as soon as i
select a value from one of the controls, all the other controls are change to
the value witch i've selected.

how can I make each combo ack by itself?

Thanks in advance
Y. Hergass
Ciaran O''Donnell - 30 Jan 2007 09:11 GMT
You need a binding source for each one. Each binding source only has one
current which the controls use.
Signature

Ciaran O''Donnell
http://wannabedeveloper.spaces.live.com

> Hi
> I try to create a few dynamic bound combobox controls, but as soon as i
[quoted text clipped - 5 lines]
> Thanks in advance
> Y. Hergass
Larry Lard - 30 Jan 2007 10:21 GMT
> Hi
> I try to create a few dynamic bound combobox controls, but as soon as i
> select a value from one of the controls, all the other controls are change to
> the value witch i've selected.
>
> how can I make each combo ack by itself?

Instead of (say)

comboBox1.Datasource = myDatasource;
comboBox2.Datasource = myDatasource;
comboBox3.Datasource = myDatasource;

do

BindingSource bs1 = new BindingSource();
bs1.Datasource = myDatasource;
comboBox1.Datasource = bs1;

BindingSource bs2 = new BindingSource();
bs2.Datasource = myDatasource;
comboBox2.Datasource = bs2;

BindingSource bs3 = new BindingSource();
bs3.Datasource = myDatasource;
comboBox3.Datasource = bs3;

Signature

Larry Lard
larrylard@googlemail.com
The address is real, but unread - please reply to the group
For VB and C# questions - tell us which version

Hergass - 30 Jan 2007 15:20 GMT
Tank you for your help

I've Only added the .Copy to the DataTable:

for i = 1 to 10
dim DT as DataTable
DT=DS.Tables(TableName)

       combo(i) = New ComboBox()
       combo(i).Size = New Size(comboWidth, 21)
       combo(i).Location = New Point(120, lineHeight * i + iTop)

      combo(i).DataSource = DT.Copy

       combo(i).ValueMember = "str"
       combo(i).DisplayMember = "val"
       combo(i).Name = tblName & "combo" & i.ToString
       combo(i).Tag = i.ToString
        grpBox.Controls.Add(combo(i))
next i

Thanks again
Hergass

> > Hi
> > I try to create a few dynamic bound combobox controls, but as soon as i
[quoted text clipped - 22 lines]
> bs3.Datasource = myDatasource;
> comboBox3.Datasource = bs3;
Tim Van Wassenhove - 30 Jan 2007 16:14 GMT
Hergass schreef:
> I try to create a few dynamic bound combobox controls, but as soon as i
> select a value from one of the controls, all the other controls are change to
> the value witch i've selected.

You need to lookup what a CurrencyManager is... And make sure all the
combobox bindings talk to a different one... (More info can be found at
eg: http://www.codeproject.com/vb/net/databindingconcepts.asp)

Signature

Tim Van Wassenhove <url:http://www.timvw.be/>


Rate this thread:







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.