473,800 Members | 2,607 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 4146
Hello Strah
You can use something like it but it will only find one
character...

Private Sub ComboBox1_KeyDo wn(ByVal sender As Object,
ByVal e As System.Windows. Forms.KeyEventA rgs) Handles
ComboBox1.KeyDo wn
Me.ComboBox1.Fi ndString(e.KeyV alue.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_KeyDo wn(ByVal sender As Object,
ByVal e As System.Windows. Forms.KeyEventA rgs) Handles
ComboBox1.KeyDo wn
Me.ComboBox1.Fi ndString(e.KeyV alue.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}BTInte rnet{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*******@disc ussions.microso ft.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_KeyDo wn(ByVal sender As Object,
ByVal e As System.Windows. Forms.KeyEventA rgs) Handles
ComboBox1.KeyDo wn
Me.ComboBox1.Fi ndString(e.KeyV alue.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*****@somewh ere.com> wrote in message
news:eU******** ******@TK2MSFTN GP11.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******** ******@TK2MSFTN GP09.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******** ******@TK2MSFTN GP09.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}BTInte rnet{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.AddMillisec onds(1200)
to
Now.AddMillisec onds(iOtherValu e)

Thanks,

Strah

Private Sub ComboBox1_KeyPr ess(ByVal sender As Object, ByVal e As
System.Windows. Forms.KeyPressE ventArgs) Handles ComboBox1.KeyPr ess

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.AddMillisec onds(1200)

Dim index As Integer
If Now < HoldForFewSecs Then
sFindString &= e.KeyChar.ToStr ing
index = Me.ComboBox1.Fi ndString(sFindS tring)
ComboBox1.Selec tedIndex = index
Else
sFindString = e.KeyChar.ToStr ing
index = Me.ComboBox1.Fi ndString(sFindS tring)
ComboBox1.Selec tedIndex = index
HoldForFewSecs = "1/1/0001 12:00:00 AM"
End If

End Sub
--
Strah
"One Handed Man [ OHM# ]" <O_H_M{at}BTInt ernet{dot}com> wrote in message
news:ud******** ******@TK2MSFTN GP10.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******** ******@TK2MSFTN GP09.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}BTInte rnet{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.AddMillisec onds(1200)
to
Now.AddMillisec onds(iOtherValu e)

Thanks,

Strah

Private Sub ComboBox1_KeyPr ess(ByVal sender As Object, ByVal e As
System.Windows. Forms.KeyPressE ventArgs) Handles ComboBox1.KeyPr ess

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.AddMillisec onds(1200)

Dim index As Integer
If Now < HoldForFewSecs Then
sFindString &= e.KeyChar.ToStr ing
index = Me.ComboBox1.Fi ndString(sFindS tring)
ComboBox1.Selec tedIndex = index
Else
sFindString = e.KeyChar.ToStr ing
index = Me.ComboBox1.Fi ndString(sFindS tring)
ComboBox1.Selec tedIndex = index
HoldForFewSecs = "1/1/0001 12:00:00 AM"
End If

End Sub

"One Handed Man [ OHM# ]" <O_H_M{at}BTInt ernet{dot}com> wrote in
message news:ud******** ******@TK2MSFTN GP10.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******** ******@TK2MSFTN GP09.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}BTInte rnet{dot}com


--
Best Regards - OHM

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

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

Similar topics

0
1381
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 receives focus, I need to display a small form on the side of the dropped down combobox with a keyboard simulated on it. Ok, I managed to get another form floating on the side, using a good article on vbaccelerator.com, I can get the input from the...
4
36410
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 arrows on the keyboard and the enter key to make my selection. But if I have to click on the down arrow of the combobox then I might as well use the mouse pointer to make my selection. Just curious. Thanks.
0
5795
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" event. This code (see below) by itself works as expected with a mouse. But when using keyboard arrows to navigate the ComboBox drop- down, the SelectedIndexChanged event is triggered which is what I don't want using the keyboard. Instead, I want...
0
2668
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 my Completion ComboBox using sendkey.wait. From the keyboard (that will not exist for my final application) I can enter text into my Completion and the selection completes as expected.
3
8094
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 to suppress the keyboard input. Any suggestions I could try will be appreciated
3
1184
by: Rony Steelandt | last post by:
http://www.newscientisttech.com/article/dn9066 To nice to be true ? R_ -- --- Rony Steelandt BuCodi
2
3139
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 Size(Datagrid1.GetCurrentCellBounds().Width + 3, combobox1.Size.Height) sender.Controls.Add(Combobox1) This works great. The problem is that when focus is set on the
0
1527
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 "Male" If I use non-textual items, e.g. images+labels inside ComboBox, is there a way hardcode such keyboard shortcut for each item? E.g.
5
13566
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 on the ComboBox (to choose from the dropdown list), the control stays focused/selected/active with no apparent way of deactivating it. I've created a small program that demonstrates my problem. If you comment out the lines pertaining to the...
0
9550
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10501
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10273
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10250
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9085
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6811
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5469
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4149
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3764
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.