Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27554

VS 2010 Disable autocomplete on a combobox

$
0
0
Hello every one,

I am new here and just jumped from VBA to VB.2010 (but was earlier VB6 untill I found Access programming environment lovely and now am back)
I have appreciated the concept of managed codes and getting on well with a few classes. Going to the point:

I have sub classed a combo to allow me give it more columns (courtesy of the many forums) but am failing to stop auto completion.
I have tried the technique of traping windows messages LB_FINDSTRING and CB_FINDSTRING to replace them with LB_FINDSTRINGEXACT and CB_FINDSTRINGEXACT but I have failed to locate where and when the messages are handled. Code below is an excerpt from my combo subclass.

Private Declare Function SendMessagebyString Lib "user32" Alias "SendMessageA" (ByVal hWND As Int32, ByVal wMsg As Int32, _
ByVal wParam As Int32, ByVal lParam As String) As Int32
Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Int32, ByVal hwndChildAfter As Int32, _
ByVal lpszClass As String, ByVal lpszWindow As String) As Int32



Protected Overrides Sub DefWndProc(ByRef m As System.Windows.Forms.Message)
Dim hwndEdit As Int32
hwndEdit = FindWindowEx(Me.Handle.ToInt32, 0, "Edit", vbNullString)
Select Case m.Msg
Case Is = LB_FINDSTRING
SendMessagebyString(hwndEdit, LB_FINDSTRINGEXACT, 0, Me.Text)
Case Is = CB_FINDSTRING
SendMessagebyString(hwndEdit, CB_FINDSTRINGEXACT, 0, Me.Text)
MsgBox(m.Msg)
Case Else
MyBase.DefWndProc(m)
End Select
End Sub

Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message)
Dim hwndEdit As Int32
hwndEdit = FindWindowEx(Me.Handle.ToInt32, 0, "Edit", vbNullString)
Select Case m.Msg
Case Is = LB_FINDSTRING
SendMessagebyString(hwndEdit, LB_FINDSTRINGEXACT, 0, Me.Text)
Case Is = CB_FINDSTRING
SendMessagebyString(hwndEdit, CB_FINDSTRINGEXACT, 0, Me.Text)
MsgBox(m.Msg)
Case Else
MyBase.WndProc(m)
End Select
End Sub


Protected Overrides Sub OnDropDown(ByVal e As System.EventArgs)
Dim hwndEdit As Int32
hwndEdit = FindWindowEx(Me.Handle.ToInt32, -1, "Edit", vbNullString)
SendMessagebyString(hwndEdit, CB_FINDSTRINGEXACT, 0, Me.Text)
SendMessagebyString(hwndEdit, LB_FINDSTRINGEXACT, 0, Me.Text)
End Sub

=============================================

Can some one please help

John A

Viewing all articles
Browse latest Browse all 27554

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>