473,395 Members | 1,631 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,395 software developers and data experts.

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 6001
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**************@TK2MSFTNGP11.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**************@TK2MSFTNGP11.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********@hotmail.com> schrieb im Newsbeitrag
news:OZ**************@TK2MSFTNGP11.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**************@TK2MSFTNGP11.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
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...
0
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...
15
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...
2
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...
3
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...
3
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...
10
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...
0
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...
9
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
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,...
0
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...
0
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,...
0
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...

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.