?
Solved

Prevent Edit of a Combo Box

Posted on 2002-06-03
6
Medium Priority
?
707 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses
Course of the Month12 days, 16 hours left to enroll

777 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