Solved

Prevent Edit of a Combo Box

Posted on 2002-06-03
6
706 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 100 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

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!

Question has a verified solution.

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

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
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…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

696 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