473,398 Members | 2,368 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,398 software developers and data experts.

Up/Down keys do not work with AutoComplete SuggestAppend textbox

I have a textbox in a DataGridView and I use the following code to AutoComplete, SuggestAppend. It appears to work OK apart from the fact that when the dropdown list appears, I cannot use the Up/Down keys to scroll through the list and I have to use the mouse to make a selection. If I click the Up/Down keys or if I lick anywhere on the screen outside the textbox and dropdown list the first item of the list is selected.

Please help. It is driving me crazy.
John

Expand|Select|Wrap|Line Numbers
  1. Private Sub dgvAppointment_EditingControlShowing(sender As Object, e As DataGridViewEditingControlShowingEventArgs) Handles dgvAppointment.EditingControlShowing
  2.  
  3.  
  4.         If (dgvAppointment.CurrentCell.ColumnIndex = DFN_GRID_intPatientID_COL) Then
  5.             ItemCode = TryCast(e.Control, TextBox)
  6.             ItemCode.Name = "textbox1"
  7.             AddHandler ItemCode.TextChanged, AddressOf ItemCode_Changed
  8.             AddHandler ItemCode.PreviewKeyDown, AddressOf ItemCode_PreviewKeyDown
  9.             namesCollection.Add("")
  10.             If ItemCode IsNot Nothing Then
  11.                 If dgvAppointment.CurrentCell.ColumnIndex = DFN_GRID_intPatientID_COL Then
  12.                     With DirectCast(e.Control, TextBox)
  13.                         .AutoCompleteMode = AutoCompleteMode.SuggestAppend
  14.                         .AutoCompleteSource = AutoCompleteSource.CustomSource
  15.                         .AutoCompleteCustomSource = namesCollection
  16.                     End With
  17.                 Else
  18.                     With DirectCast(e.Control, TextBox)
  19.                         .AutoCompleteMode = AutoCompleteMode.None
  20.                     End With
  21.                 End If
  22.             End If
  23.         End If
  24.     End Sub
  25.  
  26.     Private Sub ItemCode_Changed(sender As Object, e As EventArgs)
  27.  
  28.         Me.txtCounter.Text = CStr(CInt(Me.txtCounter.Text) + 1)
  29.  
  30.         Dim textbox As TextBox = TryCast(sender, TextBox)
  31.         Try
  32.             If textbox.TextLength = 0 Then
  33.                 intmTextLength = -1
  34.             End If
  35.  
  36.             If (intmTextLength = -1) Or (System.Math.Abs(textbox.TextLength - intmTextLength) = 1) Then
  37.                 intmTextLength = textbox.TextLength
  38.                 GetPatientByLastFirstTel(textbox.Text)
  39.             Else
  40.  
  41.             End If
  42.  
  43.         Catch ex As Exception
  44.  
  45.         End Try
  46.     End Sub
Apr 17 '14 #1
0 996

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: melanieab | last post by:
Hi again, With much help, I've finally gotten the Tab key to be recognized when a textbox is in focus, but now I'm having trouble with the up/down keys when they're focused on a custom button (on...
0
by: venu | last post by:
Hi All I need some help from u guys. iam working on aspx page.in this page i have lot fields. text boxes and dropdown lists .. First filed should be a autocomplete filed. this text has onblur...
5
by: Daniel N. | last post by:
I am trying have an application hold down the Shift key (+) and the Alt key (%) simultaneously for a given period of time, or until a condition is met. I tried this but it doesn't work:...
1
by: Daniel N | last post by:
Is there a way to hold down keys in vb.net? In the program I am writing I can simulate a MOUSE button hold down: Public Declare Sub mouse_event Lib "user32" (ByVal dwFlags As Long, ByVal dx...
3
by: Daniel N | last post by:
In my never ending search I found code that might help me to simulate holding down keys: http://www.developerfusion.co.uk/show/68/2/ However, when I copy and paste, I get the errors;
4
by: gderosa | last post by:
Hey, I've searched for a couple of days and have not found an answer. I have a textbox that needs the autocomplete/autofill feature. There are dozens of scripts out there that do this from a...
0
by: =?Utf-8?B?UiBSZXllcw==?= | last post by:
Hi - I've been searching around for a fix but can't find one... There is a bug with combobox autocomplete suggestappend. When text has a slash, "ab/cd" for example, the autocomplete feature cuts...
1
DTeCH
by: DTeCH | last post by:
Hello all :) A strange feature of the MS WebBrowser Control showed it's head, & I tried figuring it out on my own, but it's stressful enough already without me having to go another week trying...
0
Aisuru
by: Aisuru | last post by:
Hi, I'm a student currently developing a little solo project, since I'm not good at animations and what not, I made a action sequence or trying to make one, I got the timers right now, the only...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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...
0
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.