PC Review


Reply
Thread Tools Rate Thread

dynamic bound controls

 
 
=?Utf-8?B?SGVyZ2Fzcw==?=
Guest
Posts: n/a
 
      30th Jan 2007
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


 
Reply With Quote
 
 
 
 
=?Utf-8?B?Q2lhcmFuIE8nJ0Rvbm5lbGw=?=
Guest
Posts: n/a
 
      30th Jan 2007
You need a binding source for each one. Each binding source only has one
current which the controls use.
--
Ciaran O''Donnell
http://wannabedeveloper.spaces.live.com


"Hergass" wrote:

> 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
>
>

 
Reply With Quote
 
Larry Lard
Guest
Posts: n/a
 
      30th Jan 2007
Hergass wrote:
> 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;


--
Larry Lard
(E-Mail Removed)
The address is real, but unread - please reply to the group
For VB and C# questions - tell us which version
 
Reply With Quote
 
=?Utf-8?B?SGVyZ2Fzcw==?=
Guest
Posts: n/a
 
      30th Jan 2007
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


"Larry Lard" wrote:

> Hergass wrote:
> > 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;
>
>
> --
> Larry Lard
> (E-Mail Removed)
> The address is real, but unread - please reply to the group
> For VB and C# questions - tell us which version
>

 
Reply With Quote
 
Tim Van Wassenhove
Guest
Posts: n/a
 
      30th Jan 2007
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/da...ngconcepts.asp)


--
Tim Van Wassenhove <url:http://www.timvw.be/>
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Do bound controls receive any notification when the bound item is swapped for a different item? cjard Microsoft C# .NET 2 7th Jun 2007 04:22 PM
Dynamic Events from Dynamic Controls on a User Control - Guess What? Broken! mytestemailaccount@gmail.com Microsoft ASP .NET 5 23rd Mar 2005 05:06 PM
Losing state on bound controls in user controls Josh Microsoft ASP .NET 1 23rd Mar 2005 03:23 PM
BUG: Text Box Controls Data Bound on Tab Controls Andrew McKendrick Microsoft VB .NET 7 1st Jul 2004 08:20 PM
Repeater, Panel, dynamic user control - can't retrieve dynamic controls in code behind theComputer7 Microsoft C# .NET 2 23rd Jun 2004 04:47 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:13 PM.