473,508 Members | 2,460 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

works fine on the developer's computers

the following code snippet implements an "auto complete" functionality
for combo boxes. it works fine on all the developer's computers but
only selects the first item in the combo box on non-developer's
computers. what kind of workstation configuration difference could
cause this kind of problem? i'm at a lost...
Private Sub cboCountry_KeyPress(ByVal sender As System.Object, ByVal
keyPressArgs As System.Windows.Forms.KeyPressEventArgs) Handles
cboCountry.KeyPress

Dim keyCode As Integer
Dim index As Integer
Dim searchString As String

keyCode = Convert.ToInt32(keyPressArgs.KeyChar)

Select Case(keyCode)
Case Keys.PageDown
<snip>

' Scroll the scrollable panel up
Case Keys.PageUp
<snip>

Case Keys.Down, Keys.Up, Keys.Back, Keys.Right, Keys.Left
<snip>

Case Else
searchString = cboCountry.Text
index = cboCountry.FindString(searchString)

If (index >= 0) Then
cboCountry.SelectedIndex = index
cboCountry.SelectionStart = searchString.Length
cboCountry.SelectionLength =
cboCountry.Text.Length - cbo.SelectionStart

previousIndex = index
Else
cboCountry.SelectedIndex = previousIndex
cboCountry.SelectionStart =
searchString.Length - 1
cboCountry.SelectionLength =
cboCountry.Text.Length - cboCountry.SelectionStart
End If

keyPressArgs.Handled = True
End Select
End Sub ' cbo_KeyPress()

Nov 21 '05 #1
3 1081
ToddT <tu********@maritzSPAM.com>'s wild thoughts were
released on Wed, 13 Oct 2004 08:05:33 -0500 bearing the
following fruit:
the following code snippet implements an "auto complete" functionality
for combo boxes. it works fine on all the developer's computers but
only selects the first item in the combo box on non-developer's
computers. what kind of workstation configuration difference could
cause this kind of problem? i'm at a lost...
It doesn't work here. When the keypress event fires the
combo test is empty, therefore it selects the first item in
the list because previous index = 0. If I move the code to
the keyup event the correct entry is selected.

J

Private Sub cboCountry_KeyPress(ByVal sender As System.Object, ByVal
keyPressArgs As System.Windows.Forms.KeyPressEventArgs) Handles
cboCountry.KeyPress

Dim keyCode As Integer
Dim index As Integer
Dim searchString As String

keyCode = Convert.ToInt32(keyPressArgs.KeyChar)

Select Case(keyCode)
Case Keys.PageDown
<snip>

' Scroll the scrollable panel up
Case Keys.PageUp
<snip>

Case Keys.Down, Keys.Up, Keys.Back, Keys.Right, Keys.Left
<snip>

Case Else
searchString = cboCountry.Text
index = cboCountry.FindString(searchString)

If (index >= 0) Then
cboCountry.SelectedIndex = index
cboCountry.SelectionStart = searchString.Length
cboCountry.SelectionLength =
cboCountry.Text.Length - cbo.SelectionStart

previousIndex = index
Else
cboCountry.SelectedIndex = previousIndex
cboCountry.SelectionStart =
searchString.Length - 1
cboCountry.SelectionLength =
cboCountry.Text.Length - cboCountry.SelectionStart
End If

keyPressArgs.Handled = True
End Select
End Sub ' cbo_KeyPress()

Jan Hyde (VB MVP)

--
Tennis: five plus five (Kirk Miller)

[Abolish the TV License - http://www.tvlicensing.biz/]

Nov 21 '05 #2
it doesn't make sense that it works fine as coded for all the
developers here. i will try moving the code to the key up event
handler and see if that works. thx jan.

On Wed, 13 Oct 2004 15:44:06 +0100, Jan Hyde
<St***********@REMOVE.ME.uboot.com> wrote:
ToddT <tu********@maritzSPAM.com>'s wild thoughts were
released on Wed, 13 Oct 2004 08:05:33 -0500 bearing the
following fruit:
the following code snippet implements an "auto complete" functionality
for combo boxes. it works fine on all the developer's computers but
only selects the first item in the combo box on non-developer's
computers. what kind of workstation configuration difference could
cause this kind of problem? i'm at a lost...


It doesn't work here. When the keypress event fires the
combo test is empty, therefore it selects the first item in
the list because previous index = 0. If I move the code to
the keyup event the correct entry is selected.

J

Private Sub cboCountry_KeyPress(ByVal sender As System.Object, ByVal
keyPressArgs As System.Windows.Forms.KeyPressEventArgs) Handles
cboCountry.KeyPress

Dim keyCode As Integer
Dim index As Integer
Dim searchString As String

keyCode = Convert.ToInt32(keyPressArgs.KeyChar)

Select Case(keyCode)
Case Keys.PageDown
<snip>

' Scroll the scrollable panel up
Case Keys.PageUp
<snip>

Case Keys.Down, Keys.Up, Keys.Back, Keys.Right, Keys.Left
<snip>

Case Else
searchString = cboCountry.Text
index = cboCountry.FindString(searchString)

If (index >= 0) Then
cboCountry.SelectedIndex = index
cboCountry.SelectionStart = searchString.Length
cboCountry.SelectionLength =
cboCountry.Text.Length - cbo.SelectionStart

previousIndex = index
Else
cboCountry.SelectedIndex = previousIndex
cboCountry.SelectionStart =
searchString.Length - 1
cboCountry.SelectionLength =
cboCountry.Text.Length - cboCountry.SelectionStart
End If

keyPressArgs.Handled = True
End Select
End Sub ' cbo_KeyPress()

Jan Hyde (VB MVP)


Nov 21 '05 #3
after moving the code to the key up event handler, it now works for
everyone. i wonder why...

thx for the suggestion jan.

On Wed, 13 Oct 2004 15:44:06 +0100, Jan Hyde
<St***********@REMOVE.ME.uboot.com> wrote:
ToddT <tu********@maritzSPAM.com>'s wild thoughts were
released on Wed, 13 Oct 2004 08:05:33 -0500 bearing the
following fruit:
the following code snippet implements an "auto complete" functionality
for combo boxes. it works fine on all the developer's computers but
only selects the first item in the combo box on non-developer's
computers. what kind of workstation configuration difference could
cause this kind of problem? i'm at a lost...


It doesn't work here. When the keypress event fires the
combo test is empty, therefore it selects the first item in
the list because previous index = 0. If I move the code to
the keyup event the correct entry is selected.

J

Private Sub cboCountry_KeyPress(ByVal sender As System.Object, ByVal
keyPressArgs As System.Windows.Forms.KeyPressEventArgs) Handles
cboCountry.KeyPress

Dim keyCode As Integer
Dim index As Integer
Dim searchString As String

keyCode = Convert.ToInt32(keyPressArgs.KeyChar)

Select Case(keyCode)
Case Keys.PageDown
<snip>

' Scroll the scrollable panel up
Case Keys.PageUp
<snip>

Case Keys.Down, Keys.Up, Keys.Back, Keys.Right, Keys.Left
<snip>

Case Else
searchString = cboCountry.Text
index = cboCountry.FindString(searchString)

If (index >= 0) Then
cboCountry.SelectedIndex = index
cboCountry.SelectionStart = searchString.Length
cboCountry.SelectionLength =
cboCountry.Text.Length - cbo.SelectionStart

previousIndex = index
Else
cboCountry.SelectedIndex = previousIndex
cboCountry.SelectionStart =
searchString.Length - 1
cboCountry.SelectionLength =
cboCountry.Text.Length - cboCountry.SelectionStart
End If

keyPressArgs.Handled = True
End Select
End Sub ' cbo_KeyPress()

Jan Hyde (VB MVP)


Nov 21 '05 #4

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

Similar topics

5
3107
by: gabbott | last post by:
I've designed a very simple VB.NET project that uses the .NET framework functionality to access registry keys. At the moment it pulls values from a few keys and puts them into a listbox. The...
99
6012
by: Jim Hubbard | last post by:
It seems that Microsoft not only does not need the classic Visual Basic developer army (the largest army of developers the world has ever seen), but now they don't need ANY Windows developer at a...
12
5538
by: catyionic | last post by:
hi, Due to trying many different form options, with none of them working, I opted for this to receive info back from this site: http:\\www.elderslastwish.com <form name="feedback_form"...
0
1124
by: Michael Mayer | last post by:
First of all, sorry for the cross-post. Seems like there should be a managed directx newsgroup. I'm trying to open the following sample application that comes with the DirectX SDK....
0
864
by: treilly via DotNetMonster.com | last post by:
Hi all, I have been trying to figure this out for about 4 hours and it's driving me nuts. I have a .net script that parses through an xml file and creates several controls on a page. ...
0
945
by: sumana | last post by:
Hi, I need to create a web application which is accessible from various devices other than the desktop computers, like the mobile or hand held computers etc. How should I be doing this using...
10
1823
by: Smurff | last post by:
Hi, This code works fine on win and linux but not on hpux. All is compiled with gcc. Can anyone help please? /*****************************************************************************/ /*...
5
1735
by: Anand Ganesh | last post by:
Hello Everybody, I have a line in a Javascript function as follows <%=ServerSideVariable%>; This works fine in 2005.NET But in 2008.NET Visual Web Developer this gives as warning saying...
0
7231
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7133
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...
1
7066
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...
0
7504
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5643
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,...
0
4724
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...
0
3214
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...
0
3198
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
773
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.