Re: UserControl Static ComboBox
- From: "Nicholas Paldino [.NET/C# MVP]" <mvp@xxxxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 27 Jul 2005 12:44:11 -0400
Mark,
Create a string array with your 40 entries and store that where all 40
comboboxes can access it.
Then, set the DataSource property on each combobox to that array.
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mvp@xxxxxxxxxxxxxxxxxxxxxxxxxxx
"Mark Jerde" <MarkJerde@xxxxxxxxxxxxxxxx> wrote in message
news:%230tg1MrkFHA.1996@xxxxxxxxxxxxxxxxxxxxxxx
> I'm not finding help in Google. VS .NET 2003.
>
> I have a user control with a ComboBox. At runtime the ComboBox gets
> loaded with a long list of strings. Since I have up to 40 controls on a
> form I'm trying to figure out a way for all 40 combobox controls to share
> the same list of items.
>
> The ComboBox.Items property is read only so setting all 40 to the same
> ObjectCollection won't work.
>
> On a whim I made the combobox static in the UC:
> private static System.Windows.Forms.ComboBox cboFields;
>
> This "works" from a data standpoint, as Items.innerlist is the same (and
> correct) in all 40 UCs after initializing the first one. But it doesn't
> work from the UI standpoint. The ComboBox control doesn't like being
> shared across multiple UCs.
>
> Suggestions? Or is there no alternative to haviing the same Items in all
> 40 instances?
>
> Thanks.
>
> -- Mark
>
>
.
- Follow-Ups:
- Re: UserControl Static ComboBox
- From: Mark Jerde
- Re: UserControl Static ComboBox
- References:
- UserControl Static ComboBox
- From: Mark Jerde
- UserControl Static ComboBox
- Prev by Date: Re: Webform with NO IE toolbar (just ie window) possible?
- Next by Date: Re: console application question
- Previous by thread: UserControl Static ComboBox
- Next by thread: Re: UserControl Static ComboBox
- Index(es):
Relevant Pages
|
Loading