473,499 Members | 1,568 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 20 '05 #1
3 1472
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 20 '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 20 '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 20 '05 #4

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

Similar topics

0
1230
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
1354
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
2943
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
2699
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
6007
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...
3
3466
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...
10
11805
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
1265
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
9665
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...
3
17214
by: Simon van Beek | last post by:
Dear reader, What can be wrong in my ComboBox, the property "Auto Expand" is set to Yes, but by typing in the ComboBox it doesn't expand. Is this because the source of the ComboBox is a...
0
7009
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...
1
6899
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...
0
5475
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,...
1
4919
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...
0
4602
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...
0
3103
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3094
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1427
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
302
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.