473,789 Members | 2,617 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 ControlWithComb oBox : MyControls.Base Control, IDataEntryContr ol
{
...
protected System.Windows. Forms.ComboBox comboBox;
...
public ComboBox.Object Collection 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 6397
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 DesignerVisibil ity, and you need to use the
StringCollectio nEditor UITypeEditor.

[Description("Ge ts the collection of items displayed by the current combo
box editor."),
DesignerSeriali zationVisibilit y(DesignerSeria lizationVisibil ity.Content),
Editor("System. Windows.Forms.D esign.StringCol lectionEditor, System.Design",
typeof(System.D rawing.Design.U ITypeEditor))]
public ComboBox.Object Collection Items
{
get{ return comboBox.Items; }
}

-Rachel

"Rachel Suddeth" <ra****@bldhoun d.com> wrote in message
news:uc******** ******@TK2MSFTN GP11.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 ControlWithComb oBox : MyControls.Base Control,
IDataEntryContr ol
{
...
protected System.Windows. Forms.ComboBox comboBox;
...
public ComboBox.Object Collection 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
8534
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 of doing it. I have a table with products, tblProducts, some of them are Active while others are Inactive. The form shows all the products purchased by a customer, both Active and Inactive in a ComboBox, cbProducts. My client wants to view all...
8
12107
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 combobox. What is the solution? Thank you in advance.
4
1753
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
4665
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 combo by allowing the user to dynamically type in the new value directly in the combo box whcih in turn updates the lookup table and then when they have finished leaves that particular cell on the grid with the correct value. Seems...
30
4606
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 corresponding field in the lookup table. In my data table we store the ID in what I will call the 'key' field. == Description of the desired operation:
6
2883
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 and the coresponding 'Id' from the lookup table is to be inserted into the field of the new record. I have two simple tables. "tblPerson" is the data table. The lookup
0
2018
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 of different screens down to a minimum, I'm trying to use the same Windows Forms for both browsing and for updating. This works fine for TextBoxes, but I'm running into problems with my DropDownLists (ComboBoxes).
6
10822
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 modify the Items collection to be {two,one,three} and now want "two" to appear in the combobox text. However, the combobox text is now blank. the is apparently somehow the result of having changed the combobox.Items collection. If, trying to fix...
4
5112
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 too long. A user selects a name from the combobox and runs a query. Originally, this combox was on a form in an MS Access ADP which was linked directly to our sql server. The combobox populated withins millisecnods. How can I achieve this...
2
2917
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 change to that value. so far it works. problem is, it only works if the user change the (value of the) control with the mouse. As soon as he starts pressing the keyboard, i get errors.
0
9511
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10408
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10199
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10139
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9983
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9020
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7529
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6769
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
2
3700
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.