473,749 Members | 2,432 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Format Text of a ComboBox with DropDownStyle "DropDown"

Hello,
I try to format the text of a combobox with DropDownStyle "DropDown".
I just mean the text which is displayed when the combobox isn't touched.
Usually it displays the ToString() method of the SelectedItem. But I want to
override the it.
Overriding the ToString() of the class of the SelectedItem doesn't help
because I can't touch the class.
Maybe I have to rewrite the WndProc WM_PAINT.
Whatever, I just need an idea. ...
Thanks!
Nov 15 '05 #1
3 6022
Hi,

You will have to create a new control which inhertits from the
combobox. Here are some examples.
http://www.onteorasoftware.com/ComboBox.aspx

Ken
----------------
<f> wrote in message news:uv******** ******@TK2MSFTN GP11.phx.gbl...
Hello,
I try to format the text of a combobox with DropDownStyle "DropDown".
I just mean the text which is displayed when the combobox isn't touched.
Usually it displays the ToString() method of the SelectedItem. But I want
to
override the it.
Overriding the ToString() of the class of the SelectedItem doesn't help
because I can't touch the class.
Maybe I have to rewrite the WndProc WM_PAINT.
Whatever, I just need an idea. ...
Thanks!

Nov 15 '05 #2
Why don't you use another class? I'm not sure I understand the problem, but
if I do, you could create a new class and have each object hold a reference
to an object of the other class you can't touch. When adding values to the
combobox, add objects of the new class. Then you have complete control over
the ToString implementation.

<f> wrote in message news:uv******** ******@TK2MSFTN GP11.phx.gbl...
Hello,
I try to format the text of a combobox with DropDownStyle "DropDown".
I just mean the text which is displayed when the combobox isn't touched.
Usually it displays the ToString() method of the SelectedItem. But I want to override the it.
Overriding the ToString() of the class of the SelectedItem doesn't help
because I can't touch the class.
Maybe I have to rewrite the WndProc WM_PAINT.
Whatever, I just need an idea. ...
Thanks!

Nov 15 '05 #3
I dont want to implement tons of new classes.
All classes which will be displayed in the combobox have a string variable
"name". So I want to override the combobox text method and display the
"name" via reflection.
"Eran Amitai" <er********@hot mail.com> schrieb im Newsbeitrag
news:OZ******** ******@TK2MSFTN GP11.phx.gbl...
Why don't you use another class? I'm not sure I understand the problem, but if I do, you could create a new class and have each object hold a reference to an object of the other class you can't touch. When adding values to the
combobox, add objects of the new class. Then you have complete control over the ToString implementation.

<f> wrote in message news:uv******** ******@TK2MSFTN GP11.phx.gbl...
Hello,
I try to format the text of a combobox with DropDownStyle "DropDown".
I just mean the text which is displayed when the combobox isn't touched.
Usually it displays the ToString() method of the SelectedItem. But I
want to
override the it.
Overriding the ToString() of the class of the SelectedItem doesn't help
because I can't touch the class.
Maybe I have to rewrite the WndProc WM_PAINT.
Whatever, I just need an idea. ...
Thanks!


Nov 15 '05 #4

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

Similar topics

0
1245
by: Just Me | last post by:
Find in Files has a dropdown box containing folders to look in. Mine has many folders that I am no longer interested in. Is there some way I can delete these from the list? I found them in the registry but am not sure what would happen if I deleted some of them there Thanks
0
1380
by: djefanten | last post by:
Hi, I have a windows form with a combobox on it (it has the DropDown as DropDownStyle, which means you can type free text in it OR you can select from a list). At the moment that combobox receives focus, I need to display a small form on the side of the dropped down combobox with a keyboard simulated on it. Ok, I managed to get another form floating on the side, using a good article on vbaccelerator.com, I can get the input from the...
15
2972
by: sara | last post by:
Hi I'm pretty new to Access here (using Access 2000), and appreciate the help and instruction. I gave myself 2.5 hours to research online and help and try to get this one, and I am not getting it. Simple database: I want to have a user enter Supply Orders (just for tracking purposes) by Item. The user may also enter a new item - "new" is a combination of Item, PartNumber and Vendor - they could have the
2
2717
by: NTE | last post by:
Access 2000 and 2003. I have made a custom toolbar to allow users to filter by form, etc. The only things I want to appear on that toolbar are the 3 buttons to control filtering. At the right end of the toolbar there is a little arrow pointing down, and if the user clicks it, it says "Add or Remove buttons." I tried the properties, etc., but can see no where to get rid of this
3
3478
by: Michael Conroy | last post by:
Hi... Synposis... Throws exception: "Specified argument was out of the range of valid values." Read on for the juicy tidbits. MySimpleClassCol mscc=new MySimpleClassCol(); private void InitCombo() {
3
1486
by: | last post by:
Hello, I try to format the text of a combobox with DropDownStyle "DropDown". I just mean the text which is displayed when the combobox isn't touched. Usually it displays the ToString() method of the SelectedItem. But I want to override the it. Overriding the ToString() of the class of the SelectedItem doesn't help because I can't touch the class. Maybe I have to rewrite the WndProc WM_PAINT. Whatever, I just need an idea. ... Thanks!
10
11923
by: cover | last post by:
I can get the current month to display in a text box by inserting value="<? print strftime("%B"); ?>"> into the code for that particular text box on a form but how can I populate a drop down with names of all the months with the current one being 'default' as it would be in the text box example? TIA
0
1281
by: Randy Smith | last post by:
Hi All, My menu control doesn't "dropdown". The "Home" menu item doesn't appear, nor does the "Jobs" item. And, the 2nd group (Labor and Materials) in web.sitemap doesn't appear at all. The Here's what web.sitemap looks like: <?xml version="1.0" encoding="utf-8" ?> <siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" > <siteMapNode title="Home" url="ShowAllJobs.aspx">
9
9697
by: Ecohouse | last post by:
I have a main form with two subforms. The first subform has the child link to the main form identity key. subform1 - Master Field: SK Child Field: TrainingMasterSK The second subform has a master-child link to the first subform. subform2 - Master Field: subTrainingModule.Form!TrainingModuleTopicSK Child Field: TrainingModuleTopicSK
0
8997
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8833
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
9568
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
9389
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
9335
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
8257
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...
0
6079
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();...
0
4881
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2794
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.