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
Solved

Prevent Edit of a Combo Box

Posted on 2002-06-03
6
703 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
  • 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
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
passing parameter in sql procedure 9 65
Exit a vb6 apps when a calling it apps closes 15 52
MsgBox 4 68
Dinamic report to Crosstab query 9 31
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…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
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…
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…

791 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