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 / December 2004

Tip: Looking for answers? Try searching our database.

Combo Control array - Selection

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Sylesh Nair - 28 Dec 2004 18:23 GMT
hello ,

I have created a Control array for a ComboBox  to populate on a tabPage .
My concern is that I 'm using a List to populate the Combo Box  like this ..

ComboArray[i].Items.Add(List[i)];

ComboArray[i].DataSource = List;

The Combo Box gets populated with all the values in the List ( Thats what I
wanted )
But when i select a value in the First Combo box the Changes reflects in all
the boxes created
Example
if if there were 6 values from 1,2,3 ..6  in the  all Combo Dropdown list .
when I select 5 in the 3rd  all the Combo's selected value changes to 5.
How do I get specifice values in different Combo According to my selection ?

Thanks
Sylesh Nair
Chris - 28 Dec 2004 21:57 GMT
It sounds like all the items in your comboArray point to the same
instance of the ComboBox instead of different instances.

Check the code you used to create the array (post it if it's short).
I'll bet that's where the problem lies.

Chris
Sylesh Nair - 29 Dec 2004 14:06 GMT
thanks for  the reply
here is the code for the Combo boX  Creation .

for(int i = 0; i < Number; i++)

{

this.List.Add( new System.Windows.Forms.ComboBox() );

((System.Windows.Forms.ComboBox)this.List[i]).Location = new
System.Drawing.Point(180, 36 + i * 40);

((System.Windows.Forms.ComboBox)this.List[i]).Name = "UC_Combo" +
i.ToString();

((System.Windows.Forms.ComboBox)this.List[i]).Size = new
System.Drawing.Size(184,20);

((System.Windows.Forms.ComboBox)this.List[i]).TabIndex = i + 2;

((System.Windows.Forms.ComboBox)this.List[i]).Text = String.Empty;

((System.Windows.Forms.ComboBox)this.List[i]).Tag = this.Count;

((System.Windows.Forms.ComboBox )this.List[i]).DropDownStyle =
System.Windows.Forms.ComboBoxStyle.DropDownList;

this.Form1.Controls.Add( ((System.Windows.Forms.ComboBox)this.List[i]) );

}

Thanks

Sylesh

> It sounds like all the items in your comboArray point to the same
> instance of the ComboBox instead of different instances.
[quoted text clipped - 3 lines]
>
> Chris
Chris - 29 Dec 2004 16:07 GMT
It looks like I lost my bet.  I can't see anything wrong with that
code.  What kind of object is this.List?  Are you using any kind of
data binding?  What does the SelectedItem event code look like?
It's very puzzling.

Chris

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.