|
-
Feb 15th, 2001, 02:18 PM
#1
Thread Starter
Addicted Member
I need a way, using an ordinary ComboBox (not Drop-Down List), to discard any typed-in entries that don't match up with an item on the list.
For example, if someone types something in, then tabs out of the ComboBox, and whatever they typed in doesn't correspond to something already in the list, the ComboBox.Text will be reset to " " in the validation code.
I'm sure this can't be too difficult but my brain is too tired. Can anyone help me?
-
Feb 15th, 2001, 03:41 PM
#2
Lively Member
here this should work:
Code:
Sub Combo1_LostFocus()
For a = 0 to Combo1.listcount-1
if ucase(combo1.list(a))=ucase(combo1.text) then
exit sub
end if
combo1.text=""
Next a
End Sub
Hope this helps,
Bios
Age: 17
Languages: (Q)BASIC, Visual Basic, Dark Basic,C/C++, Visual C++, Perl, Java Script, HTML, ASP
"DO:BEEP:LOOP"
-
Feb 15th, 2001, 04:13 PM
#3
New Member
Actually...
There is a little bug in the previous code. it will not detect anything from the second item in the list down. If we make a slight change it works fine. 
Here is the modified code:
Sub Combo1_LostFocus()
For a = 0 to Combo1.listcount-1
if ucase(combo1.list(a))=ucase(combo1.text) then
exit sub
end if
Next a
combo1.text=""
End Sub
-
Feb 15th, 2001, 04:30 PM
#4
Thread Starter
Addicted Member
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|