|
-
Oct 31st, 2003, 10:55 AM
#1
Thread Starter
Hyperactive Member
combobox
I have a combobox. I want to select the item in the combobox when the text is entered (not matching just the first letter) and
the user presses enter key. Please suggest!
-
Oct 31st, 2003, 12:13 PM
#2
are you talking about finding the exact string and selecting it then? if so...
VB Code:
[Color=Blue]Private[/COLOR] [Color=Blue]Sub[/COLOR] ComboBox1_KeyUp([Color=Blue]ByVal[/COLOR] sender [Color=Blue]As[/COLOR] [Color=Blue]Object[/COLOR], [Color=Blue]ByVal[/COLOR] e [Color=Blue]As[/COLOR] System.Windows.Forms.KeyEventArgs) [Color=Blue]Handles[/COLOR] ComboBox1.KeyUp
[Color=Blue]If[/COLOR] e.KeyValue = Keys.Enter [Color=Blue]Then
[/COLOR] [Color=Blue]Dim[/COLOR] x [Color=Blue]As[/COLOR] [Color=Blue]Integer[/COLOR] = ComboBox1.FindStringExact(ComboBox1.Text)
ComboBox1.SelectedIndex = x
[Color=Blue]End[/COLOR] [Color=Blue]If
[/COLOR] [Color=Blue]End[/COLOR] [Color=Blue]Sub[/COLOR]
~
if a post is resolved, please mark it as [Resolved]
protected string get_Signature(){return Censored;}
[vbcode][php] please use code tags when posting any code [/php][/vbcode]
-
Oct 31st, 2003, 12:19 PM
#3
Thread Starter
Hyperactive Member
thanks works great, but I would rather replace FindStringExact with FindString
-
Oct 31st, 2003, 12:22 PM
#4
you can use FindString also to find the whole word ( but also to find the string by it's first character / characters )
~
if a post is resolved, please mark it as [Resolved]
protected string get_Signature(){return Censored;}
[vbcode][php] please use code tags when posting any code [/php][/vbcode]
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
|