473,320 Members | 2,202 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

ComboBox keyboard recognition?

Could anyone help me with the following:

Is there a quick, or at least known way to
force a ComboBox, having DropDownStyle=
DropDownList, to recognize keyboard input
and perform Item selection based on that.

To be more specific: I have a list of 150 items
(all 7-digit numeric values) represented in
the combobox, and they are sorted. Instead
of scrolling to the specific item, I'd like to
be able to start typing on the keyboard and
have combobox recognize what I am typing,
and based on that, the selected value gets
changed. As I am progressing with the keyboard
input, the selection gets narrowed down.
Say I have to find number 1455601, and start
typing '1' on the keyboard, and first Item that starts
with '1' gets selected, then I type in '4', the second
digit, and then first item starting with '14' in the
combobox list gets selected, and I type in '5'
and selected item is first value starting with '145'
and so forth.

This behavior is very similar to Windows Explorer
(at least in WinXP) when there is a large number
of folders, and instead of scrolling up and down
the browser, typing in first few letters/numbers
of the folder, the sought folder gets selected.

Thanks in advance,

Strah

Nov 20 '05 #1
9 4130
Hello Strah
You can use something like it but it will only find one
character...

Private Sub ComboBox1_KeyDown(ByVal sender As Object,
ByVal e As System.Windows.Forms.KeyEventArgs) Handles
ComboBox1.KeyDown
Me.ComboBox1.FindString(e.KeyValue.ToString)
End Sub
Kind Regards
Jorge
-----Original Message-----
Could anyone help me with the following:

Is there a quick, or at least known way to
force a ComboBox, having DropDownStyle=
DropDownList, to recognize keyboard input
and perform Item selection based on that.

To be more specific: I have a list of 150 items
(all 7-digit numeric values) represented in
the combobox, and they are sorted. Instead
of scrolling to the specific item, I'd like to
be able to start typing on the keyboard and
have combobox recognize what I am typing,
and based on that, the selected value gets
changed. As I am progressing with the keyboard
input, the selection gets narrowed down.
Say I have to find number 1455601, and start
typing '1' on the keyboard, and first Item that starts
with '1' gets selected, then I type in '4', the second
digit, and then first item starting with '14' in the
combobox list gets selected, and I type in '5'
and selected item is first value starting with '145'
and so forth.

This behavior is very similar to Windows Explorer
(at least in WinXP) when there is a large number
of folders, and instead of scrolling up and down
the browser, typing in first few letters/numbers
of the folder, the sought folder gets selected.

Thanks in advance,

Strah

.

Nov 20 '05 #2
Well, the OP can already do that because when the Style is set to dropdown
list, the first character is searchable, but subsequent characters are not.

Regards - OHM
Jorge wrote:
Hello Strah
You can use something like it but it will only find one
character...

Private Sub ComboBox1_KeyDown(ByVal sender As Object,
ByVal e As System.Windows.Forms.KeyEventArgs) Handles
ComboBox1.KeyDown
Me.ComboBox1.FindString(e.KeyValue.ToString)
End Sub
Kind Regards
Jorge
-----Original Message-----
Could anyone help me with the following:

Is there a quick, or at least known way to
force a ComboBox, having DropDownStyle=
DropDownList, to recognize keyboard input
and perform Item selection based on that.

To be more specific: I have a list of 150 items
(all 7-digit numeric values) represented in
the combobox, and they are sorted. Instead
of scrolling to the specific item, I'd like to
be able to start typing on the keyboard and
have combobox recognize what I am typing,
and based on that, the selected value gets
changed. As I am progressing with the keyboard
input, the selection gets narrowed down.
Say I have to find number 1455601, and start
typing '1' on the keyboard, and first Item that starts
with '1' gets selected, then I type in '4', the second
digit, and then first item starting with '14' in the
combobox list gets selected, and I type in '5'
and selected item is first value starting with '145'
and so forth.

This behavior is very similar to Windows Explorer
(at least in WinXP) when there is a large number
of folders, and instead of scrolling up and down
the browser, typing in first few letters/numbers
of the folder, the sought folder gets selected.

Thanks in advance,

Strah

.


--
Best Regards - OHM

O_H_M{at}BTInternet{dot}com
Nov 20 '05 #3

Jorge,

thanks, but this is actually default behavior
of the ComboBox, so no code required.

I was going to use KeyDown event to
achieve what I need, but before starting
I wanted to double check if there was
something like that already available, just
to avoid re-inventing a wheel.

However, I was not aware of
ComboBox's FindString Method
which I will be using to build a
string of KeyValues provided by
the user.

Thanks again and Happy New Year,

Strah
--
Strah @ Langan

"Jorge" <an*******@discussions.microsoft.com> wrote in message
news:00****************************@phx.gbl...
Hello Strah
You can use something like it but it will only find one
character...

Private Sub ComboBox1_KeyDown(ByVal sender As Object,
ByVal e As System.Windows.Forms.KeyEventArgs) Handles
ComboBox1.KeyDown
Me.ComboBox1.FindString(e.KeyValue.ToString)
End Sub
Kind Regards
Jorge
-----Original Message-----
Could anyone help me with the following:

Is there a quick, or at least known way to
force a ComboBox, having DropDownStyle=
DropDownList, to recognize keyboard input
and perform Item selection based on that.

To be more specific: I have a list of 150 items
(all 7-digit numeric values) represented in
the combobox, and they are sorted. Instead
of scrolling to the specific item, I'd like to
be able to start typing on the keyboard and
have combobox recognize what I am typing,
and based on that, the selected value gets
changed. As I am progressing with the keyboard
input, the selection gets narrowed down.
Say I have to find number 1455601, and start
typing '1' on the keyboard, and first Item that starts
with '1' gets selected, then I type in '4', the second
digit, and then first item starting with '14' in the
combobox list gets selected, and I type in '5'
and selected item is first value starting with '145'
and so forth.

This behavior is very similar to Windows Explorer
(at least in WinXP) when there is a large number
of folders, and instead of scrolling up and down
the browser, typing in first few letters/numbers
of the folder, the sought folder gets selected.

Thanks in advance,

Strah

.

Nov 20 '05 #4
If you go to my site in about an hour, http://www.tiberiansun.us/Projects, I
have a control there that does a pattern match on what you typed in, so as
you type, things get eliminated. It's a new implementation of my old
AutoCombeX for VB6.

HTH
Sueffel
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.556 / Virus Database: 348 - Release Date: 12/26/2003
Nov 20 '05 #5
Hi Sueffel,

thanks for your help, I appreciate it a lot.
I am not sure I would change entire control
for something like that, I was just looking
for a possible property, or piece of code.
Now, that it seems that what I am looking
for is not that common, I will spend some
time to develop it myself.

Thanks,

--
Strah
"Sueffel" <so*****@somewhere.com> wrote in message
news:eU**************@TK2MSFTNGP11.phx.gbl...
If you go to my site in about an hour, http://www.tiberiansun.us/Projects, I have a control there that does a pattern match on what you typed in, so as
you type, things get eliminated. It's a new implementation of my old
AutoCombeX for VB6.

HTH
Sueffel
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.556 / Virus Database: 348 - Release Date: 12/26/2003

Nov 20 '05 #6
never mind, I've got it. thanks

--
Strah @ Langan

"Strahimir Antoljak" <st***@netzero.net> wrote in message
news:e3**************@TK2MSFTNGP09.phx.gbl...
Could anyone help me with the following:

Is there a quick, or at least known way to
force a ComboBox, having DropDownStyle=
DropDownList, to recognize keyboard input
and perform Item selection based on that.

To be more specific: I have a list of 150 items
(all 7-digit numeric values) represented in
the combobox, and they are sorted. Instead
of scrolling to the specific item, I'd like to
be able to start typing on the keyboard and
have combobox recognize what I am typing,
and based on that, the selected value gets
changed. As I am progressing with the keyboard
input, the selection gets narrowed down.
Say I have to find number 1455601, and start
typing '1' on the keyboard, and first Item that starts
with '1' gets selected, then I type in '4', the second
digit, and then first item starting with '14' in the
combobox list gets selected, and I type in '5'
and selected item is first value starting with '145'
and so forth.

This behavior is very similar to Windows Explorer
(at least in WinXP) when there is a large number
of folders, and instead of scrolling up and down
the browser, typing in first few letters/numbers
of the folder, the sought folder gets selected.

Thanks in advance,

Strah

Nov 20 '05 #7
OK, then let us have it too.

OHM
Strahimir Antoljak wrote:
never mind, I've got it. thanks
"Strahimir Antoljak" <st***@netzero.net> wrote in message
news:e3**************@TK2MSFTNGP09.phx.gbl...
Could anyone help me with the following:

Is there a quick, or at least known way to
force a ComboBox, having DropDownStyle=
DropDownList, to recognize keyboard input
and perform Item selection based on that.

To be more specific: I have a list of 150 items
(all 7-digit numeric values) represented in
the combobox, and they are sorted. Instead
of scrolling to the specific item, I'd like to
be able to start typing on the keyboard and
have combobox recognize what I am typing,
and based on that, the selected value gets
changed. As I am progressing with the keyboard
input, the selection gets narrowed down.
Say I have to find number 1455601, and start
typing '1' on the keyboard, and first Item that starts
with '1' gets selected, then I type in '4', the second
digit, and then first item starting with '14' in the
combobox list gets selected, and I type in '5'
and selected item is first value starting with '145'
and so forth.

This behavior is very similar to Windows Explorer
(at least in WinXP) when there is a large number
of folders, and instead of scrolling up and down
the browser, typing in first few letters/numbers
of the folder, the sought folder gets selected.

Thanks in advance,

Strah


--
Best Regards - OHM

O_H_M{at}BTInternet{dot}com
Nov 20 '05 #8

This solution will 'remember' your keys
typed sequence for 1200 milliseconds
(1.2 secs) and then it will start over (that
is similar to WinExplorer).

If you want the procedure to remember it
for some other timespan, change:
Now.AddMilliseconds(1200)
to
Now.AddMilliseconds(iOtherValue)

Thanks,

Strah

Private Sub ComboBox1_KeyPress(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles ComboBox1.KeyPress

Static sFindString As String = ""
Static HoldForFewSecs As DateTime = "1/1/0001 12:00:00 AM"

If HoldForFewSecs = "1/1/0001 12:00:00 AM" Then HoldForFewSecs =
Now.AddMilliseconds(1200)

Dim index As Integer
If Now < HoldForFewSecs Then
sFindString &= e.KeyChar.ToString
index = Me.ComboBox1.FindString(sFindString)
ComboBox1.SelectedIndex = index
Else
sFindString = e.KeyChar.ToString
index = Me.ComboBox1.FindString(sFindString)
ComboBox1.SelectedIndex = index
HoldForFewSecs = "1/1/0001 12:00:00 AM"
End If

End Sub
--
Strah
"One Handed Man [ OHM# ]" <O_H_M{at}BTInternet{dot}com> wrote in message
news:ud**************@TK2MSFTNGP10.phx.gbl...
OK, then let us have it too.

OHM
Strahimir Antoljak wrote:
never mind, I've got it. thanks
"Strahimir Antoljak" <st***@netzero.net> wrote in message
news:e3**************@TK2MSFTNGP09.phx.gbl...
Could anyone help me with the following:

Is there a quick, or at least known way to
force a ComboBox, having DropDownStyle=
DropDownList, to recognize keyboard input
and perform Item selection based on that.

To be more specific: I have a list of 150 items
(all 7-digit numeric values) represented in
the combobox, and they are sorted. Instead
of scrolling to the specific item, I'd like to
be able to start typing on the keyboard and
have combobox recognize what I am typing,
and based on that, the selected value gets
changed. As I am progressing with the keyboard
input, the selection gets narrowed down.
Say I have to find number 1455601, and start
typing '1' on the keyboard, and first Item that starts
with '1' gets selected, then I type in '4', the second
digit, and then first item starting with '14' in the
combobox list gets selected, and I type in '5'
and selected item is first value starting with '145'
and so forth.

This behavior is very similar to Windows Explorer
(at least in WinXP) when there is a large number
of folders, and instead of scrolling up and down
the browser, typing in first few letters/numbers
of the folder, the sought folder gets selected.

Thanks in advance,

Strah


--
Best Regards - OHM

O_H_M{at}BTInternet{dot}com

Nov 20 '05 #9
Thanx.

OHM

Strahimir Antoljak wrote:
This solution will 'remember' your keys
typed sequence for 1200 milliseconds
(1.2 secs) and then it will start over (that
is similar to WinExplorer).

If you want the procedure to remember it
for some other timespan, change:
Now.AddMilliseconds(1200)
to
Now.AddMilliseconds(iOtherValue)

Thanks,

Strah

Private Sub ComboBox1_KeyPress(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles ComboBox1.KeyPress

Static sFindString As String = ""
Static HoldForFewSecs As DateTime = "1/1/0001 12:00:00 AM"

If HoldForFewSecs = "1/1/0001 12:00:00 AM" Then
HoldForFewSecs = Now.AddMilliseconds(1200)

Dim index As Integer
If Now < HoldForFewSecs Then
sFindString &= e.KeyChar.ToString
index = Me.ComboBox1.FindString(sFindString)
ComboBox1.SelectedIndex = index
Else
sFindString = e.KeyChar.ToString
index = Me.ComboBox1.FindString(sFindString)
ComboBox1.SelectedIndex = index
HoldForFewSecs = "1/1/0001 12:00:00 AM"
End If

End Sub

"One Handed Man [ OHM# ]" <O_H_M{at}BTInternet{dot}com> wrote in
message news:ud**************@TK2MSFTNGP10.phx.gbl...
OK, then let us have it too.

OHM
Strahimir Antoljak wrote:
never mind, I've got it. thanks
"Strahimir Antoljak" <st***@netzero.net> wrote in message
news:e3**************@TK2MSFTNGP09.phx.gbl...
Could anyone help me with the following:

Is there a quick, or at least known way to
force a ComboBox, having DropDownStyle=
DropDownList, to recognize keyboard input
and perform Item selection based on that.

To be more specific: I have a list of 150 items
(all 7-digit numeric values) represented in
the combobox, and they are sorted. Instead
of scrolling to the specific item, I'd like to
be able to start typing on the keyboard and
have combobox recognize what I am typing,
and based on that, the selected value gets
changed. As I am progressing with the keyboard
input, the selection gets narrowed down.
Say I have to find number 1455601, and start
typing '1' on the keyboard, and first Item that starts
with '1' gets selected, then I type in '4', the second
digit, and then first item starting with '14' in the
combobox list gets selected, and I type in '5'
and selected item is first value starting with '145'
and so forth.

This behavior is very similar to Windows Explorer
(at least in WinXP) when there is a large number
of folders, and instead of scrolling up and down
the browser, typing in first few letters/numbers
of the folder, the sought folder gets selected.

Thanks in advance,

Strah


--
Best Regards - OHM

O_H_M{at}BTInternet{dot}com


--
Best Regards - OHM

O_H_M{at}BTInternet{dot}com
Nov 20 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: djefanten | last post by:
Hi, I have a windows form with a combobox on it (it has the DropDown as DropDownStyle, which means you can type free text in it OR you can select from a list). At the moment that combobox...
4
by: Sue Bricker | last post by:
Greetings. In Access, is there a way to open up a drop-down combobox with keys on the keyboard, instead of using the mouse to click on the down arrow of the combobox? I really prefer to use the...
0
by: George Hartas | last post by:
I am using Visual C# .NET 2003 to make a ComboBox accept both mouse and keyboard selection. For mouse selection code, I double-clicked ComboBox to get the default "comboBox1_SelectedIndexChanged"...
0
by: Hiroyuki Tanaka | last post by:
Hi All, I am trying to develop an application for a touch screen using buttons for the numeric pad with Completion ComboBoxes. At the moment I am having a problem sending the button presses to...
3
by: **Developer** | last post by:
I want to have a ComboBox that is loaded programmically not except keyboard inputs. I tried in KeyDown not calling MyBase.OnKeyDown(e) and also tried setting e.Handled = True but neither appear...
3
by: Rony Steelandt | last post by:
http://www.newscientisttech.com/article/dn9066 To nice to be true ? R_ -- --- Rony Steelandt BuCodi
2
by: mfleet1973 | last post by:
Hello (again), Within my datagrid I add a control to the datagridtextboxcolumn when the underlying textbox receives focus as follows: Combobox1.Size = New...
0
by: Oleg Ogurok | last post by:
Hi there, I have a WPF combobox with two values "Male" and "Female". It seems by default the control supports mnemonics, e.g. if I press "M" on keyboard, it sets the current ComboBoxItem to...
5
by: latortugamorada | last post by:
I have searched high and low for a solution to this incredibly vexing problem and am at the brink of insanity/desperation/severe upsettedness. I have a problem with ComboBoxes in .NET. Once I click...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.