473,321 Members | 1,748 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,321 software developers and data experts.

ComboBox in User Control

When I put a ComboBox on a form, I can enter strings through the designer to
fill Items collections. I have put a ComboBox in a UserControl, and exposed
the the Items collections with the same type...

public class ControlWithComboBox : MyControls.BaseControl, IDataEntryControl
{
...
protected System.Windows.Forms.ComboBox comboBox;
...
public ComboBox.ObjectCollection Items
{
get{ return comboBox.Items; }
}
...
}

Now I get a different TypeEditor in the desiger, and it's useless. Is there
something simple I'm missing to tell VS that this field can be changed in
the same way as the ComboBox.Items?

Thanks,
Rachel

__________________________________________________ ____________

Roydan Enterprises Ltd
602 North 9th Street
Manitowoc, WI 54220-3924

1-800-236-6906
(920)-684-3688
Fax: (920)-684-3630

Nov 16 '05 #1
1 6329
Since no one seemed to know this, I thought I'd post the solution I finally
figured out. It's not well documented in the help, and I thought someone
else might like to know... there are 2 things (attributes). You need to give
the elements of the collection DesignerVisibility, and you need to use the
StringCollectionEditor UITypeEditor.

[Description("Gets the collection of items displayed by the current combo
box editor."),
DesignerSerializationVisibility(DesignerSerializat ionVisibility.Content),
Editor("System.Windows.Forms.Design.StringCollecti onEditor, System.Design",
typeof(System.Drawing.Design.UITypeEditor))]
public ComboBox.ObjectCollection Items
{
get{ return comboBox.Items; }
}

-Rachel

"Rachel Suddeth" <ra****@bldhound.com> wrote in message
news:uc**************@TK2MSFTNGP11.phx.gbl...
When I put a ComboBox on a form, I can enter strings through the designer
to fill Items collections. I have put a ComboBox in a UserControl, and
exposed the the Items collections with the same type...

public class ControlWithComboBox : MyControls.BaseControl,
IDataEntryControl
{
...
protected System.Windows.Forms.ComboBox comboBox;
...
public ComboBox.ObjectCollection Items
{
get{ return comboBox.Items; }
}
...
}

Now I get a different TypeEditor in the desiger, and it's useless. Is
there something simple I'm missing to tell VS that this field can be
changed in the same way as the ComboBox.Items?

Thanks,
Rachel

__________________________________________________ ____________

Roydan Enterprises Ltd
602 North 9th Street
Manitowoc, WI 54220-3924

1-800-236-6906
(920)-684-3688
Fax: (920)-684-3630

Nov 16 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Nicolae Fieraru | last post by:
Hi All, I am trying to change the rowsource of a combobox when I click on it. I played with many events, associated with the form and the combobox, but still haven't figured out what is the way...
8
by: Zlatko Matiæ | last post by:
There is a form (single form) and a combobox. I want that current record of the form is adjusted according to selected value in the combobox. Cuurrent record should be the same as the value in the...
4
by: David Sworder | last post by:
Hi, I have a ComboBox that contains 1,400 sorted items . Here's the list: abba apple ... cabba caccaa capple
5
by: Aaron Ackerman | last post by:
I have a bound combobox the appears on a cell within the column of my bound grid when the user clicks on a cell n(In my vb.net WinForm app). I am trying to allow the adding of an item to that bound...
30
by: dbuchanan | last post by:
ComboBox databindng Problem == How the ComboBox is setup and used: My comboBox is populated by a lookup table. The ValueMember is the lookup table's Id and the DisplayMember is the text from a...
6
by: dbuchanan | last post by:
VS2005 I've been reading all the help I can on the topic (MSDN, other) but I can't make sense of this. Desired behavior; The user is to choose from the displayed list of the databound combobox...
0
by: Frnak McKenney | last post by:
Can I use a bound ComboBox for both browsing and editing? I'm working on a small, standalone database application using Visual C#.NET 2003 and an Access data file. In order to keep the number...
6
by: tbrown | last post by:
I have a combobox with items like this: {one,two,three}. The selected index is 0, so "one" appears in the combobox text. When the user drops down the list, and selects "two", for example, I...
4
by: =?Utf-8?B?UmljaA==?= | last post by:
Greetings, I have to load 30,000 unique names into a combox. Filling a dataTable takes only a few milliseconds. But populating the combobox and displaying the list takes several seconds - way...
2
by: Horst JENS | last post by:
Hi group, have problems with combobox-control in a form (access 2003). I added VBA-Code to on-Change event of the control. If the user choose an value from the control, the filter of the form...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.