Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Combo box, (style = CsDropdownlist) show default value

Posted on 2000-02-17
8
Medium Priority
?
1,817 Views
Last Modified: 2008-02-20
Hi,

I am using delphi 3.02

I have a combo box with a fixed known number of values (these are the ONLY valid values, so I have made the type CsDropDownList).

When I display the combo box I want a defuault value already shown, but currently it just shows blank until you select a value. I have tried code like combobox1.text := 'Default'; but still it initially shows a blank value. Is there anyway of overcoming this, or is this just the way the combo box of this type works?

Thanks
Clyde
0
Comment
Question by:clyde99
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
8 Comments
 

Author Comment

by:clyde99
ID: 2533592
Addendum:

The code combobox1.text := 'Default';
works for all other types of combo boxes, except the CsDropDownList and unfortunately this is the type of combo box I really want to use.
0
 
LVL 6

Expert Comment

by:edey
ID: 2533707
You can set the comboBox's itemIndex property in the parent form's OnCreate handler.

GL
Mike
0
 

Accepted Solution

by:
adpearce earned 200 total points
ID: 2533774
clyde,

Use the Combox's Items IndexOf property to select the index of the element you want.  Then just set the ItemIndex to the value returned:

ComboBox1.ItemIndex := ComboBox1.Items.IndexOf('default');

regards,
Ant.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 6

Expert Comment

by:edey
ID: 2535385
hmmmm....
0
 

Author Comment

by:clyde99
ID: 2539425
what is the hmmmm.... for edey ????
0
 
LVL 6

Expert Comment

by:edey
ID: 2540373
It is not generally cosidered polite to "rehash" someone else's comment as an answer


GL
Mike
0
 

Author Comment

by:clyde99
ID: 2540695
Mike,

Sorry. This is partly my fault. I considerd both answers to be correct, but when I looked at them adpearce was before yours, no I naturally assumed he had answered first and awarded the points.

My apologies, I should have had a closer look at the TIME.

Regards
Clyde
0
 
LVL 6

Expert Comment

by:edey
ID: 2540742
Hey no problem, the idea here is simply to lend a helping hand, perhaps to expect the same at a later date :)  Glad to here that you were able to find an acceptable solution :)

GL
Mike
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question