Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Prevent Edit of a Combo Box

Posted on 2002-06-03
6
Medium Priority
?
708 Views
Last Modified: 2012-06-27
I have several combo boxes in an application I'm working on. I don't want to allow the users to just type something into the combo box - infact - I want them to be able to select ONLY a list item in the combo box.

I am still not sure if I want to allow them to type in the field (and catch the case where the typed value does not exist in the list) or to completely stop typing in the field. My personal preference (and from what I can tell the easier of the two options) would be the later.

I've played with validate, and lost focus. They don't quite behave how I want them to. For example, a user could type in string, click the continue button. This would call the lost_focus event which would determin that the string was bad, set the combo to some value (user would have no control of this) and then continue on...



Any ideas/code fragments greatly appriecated.

Woot.
0
Comment
Question by:woottond
[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
  • 3
  • 2
6 Comments
 
LVL 22

Accepted Solution

by:
rspahitz earned 400 total points
ID: 7051720
If I understand you correctly, what you're looking for is in the Style property...set it to 2-Dropdown List.
0
 

Author Comment

by:woottond
ID: 7051826
perfect... now I have to figure out how to set the initial value - dum dee dum dum...

brb
woot.
0
 

Author Comment

by:woottond
ID: 7051838
done and done.

Thanks - save me hours of stupid work around coding.

=)

cheers,
woot.
0
Independent Software Vendors: 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 38

Expert Comment

by:PaulHews
ID: 7051840
>now I have to figure out how to set the initial value

Set the listindex property to correspond to the item you want.  (Points go to rspahitz)
0
 
LVL 22

Expert Comment

by:rspahitz
ID: 7051848
Combo1.Text = IntialValue

or

Combo1.ListIndex = Item_Between_0_And_ListCount-1


Glad to help.
0
 

Author Comment

by:woottond
ID: 7051867
yes -- got the listindex as soon as I looked at it, not sure why I hadn't thought to use the style property! had been playing with everything from lccked, enabled, to on_lost_focus, to validate...

cheers guys,
woot.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Suggested Courses

618 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