Determing if user input is on list in Combo Box

G

Guest

I have a combo box that lists all standard sizes for an item we manufacture.
It is set to allow the user to input a value not on the list if they desire.
However, if they input their own size, I need to determine this, so I can
charge for a non-standard size.

Note that I am trying to make a generic VBA routine that I can use in both
Excel and AutoCAD, so I don't want to use any Excel specific commands. I have
populated my combo box with a command like this;

Dim StdSizes(100,100,100)
'Then I populate the array with inches, feet-inch, and meters for out
standard sizes
Combo1.Column() = StdSizes

I imagine I can use a Combo1_Change() event to determine when the user is
finished typing, and then compare the new value of the combo box to all the
values in the array to see if there are any matches.

Any other methods you can recommend?

Joe Dunfee
 
G

Guest

Since I am dependent on the wisdom others have provided here, I feel it was
important to contribute my own advice (even if I am not as experienced as
other) I think i've found a better solution.

I've gone with a for-next loop that compares the user input to every item in
the list (which is stored in an array). I have been doing this comparison
for every character the user types. It performs better than I expected.
However, now will be changing to detecting the Enter key to start my
comparison loop by using the following command;

onkey (~,MyCompareProcedure) ' note that the Tilde is equivalent to the
Enter key.

Joe Dunfee
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top