Thanks, Idle
Small addition:
Private Const WM_SIZE As Integer = &H5& 'To handle Maximizing/restoring
'..................
Case WM_ENTERSIZEMOVE, WM_SIZE
'.................
Main Topics
Browse All TopicsAfter resizing winform with a nuber of databound comboboxes (Style=DropDown, Autocomplete=SuggestAppend
Private Sub frmMain_Resize(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Resize
UnHighlightCombos(Me)
End Sub
Private Sub UnHighlightCombos(ByVal ctrlParent As Control)
For Each ctrl As Control In ctrlParent.Controls()
If TypeOf ctrl Is ComboBox Then
If Not ctrl.Focused Then
CType(ctrl, ComboBox).SelectionLength = 0
End If
Else
If ctrl.Controls.Count > 0 Then
UnHighlightCombos(ctrl)
End If
End If
Next
End Sub
but this way you can see blinking selection over combo's. Is there a better way to bypass this 'future'?
Thanks
Ark
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
PS
I'm woundering how long programmers will 'dance like monkey' around MS bugs? Here are some handlers from my app:
#Region " Event handlers"
'Handles MS bug (KB327244) - ComboBox Does Not Clear When You Set SelectedIndex to -1
Private Sub HadleComboMS_Bug(ByVal sender As Object, ByVal e As System.EventArgs)
If bFromCode Then Exit Sub
Dim cbo As ComboBox = CType(sender, ComboBox)
If cbo.SelectedIndex = -1 Then
bFromCode = True
cbo.SelectedIndex = 0
cbo.SelectedIndex = -1
bFromCode = False
End If
End Sub
'Handles MS bug (KB313513) - PRB: InvalidCastException When You Bind DateTimePicker That Contains a Null Value
Private Sub DTFormatter(ByVal sender As Object, ByVal e As ConvertEventArgs)
If Not e.DesiredType Is GetType(DateTime) Then Return
If e.Value.GetType Is GetType(System.DBNull) Then e.Value = CType("1/1/1800", System.DateTime)
End Sub
'Handles MS bug (KB313513) - PRB: InvalidCastException When You Bind DateTimePicker That Contains a Null Value
Private Sub DTParser(ByVal sender As Object, ByVal e As ConvertEventArgs)
If Not e.DesiredType Is GetType(DateTime) Then Return
If Not e.Value.GetType Is GetType(DateTime) Then Return
Dim value As String = CType(e.Value, String)
If value.Equals("1/1/1800") Then e.Value = System.DBNull.Value
End Sub
Business Accounts
Answer for Membership
by: Idle_MindPosted on 2007-08-05 at 09:49:03ID: 19634623
Hi Ark,
ge) = True
= False
) Then
ge) Then
Try something like this out...
Public Class Form1
Private combos As New ArrayList
Private Const WM_ENTERSIZEMOVE As Integer = &H231&
Private Const WM_EXITSIZEMOVE As Integer = &H232
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
GetCombos(Me)
End Sub
Private Sub GetCombos(ByVal ctrlParent As Control)
For Each ctrl As Control In ctrlParent.Controls()
If TypeOf ctrl Is ComboBox Then
combos.Add(New MyComboBox(ctrl))
Else
If ctrl.Controls.Count > 0 Then
GetCombos(ctrl)
End If
End If
Next
End Sub
Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Messa
Select Case m.Msg
Case WM_ENTERSIZEMOVE
MyComboBox.SuppressSetText
Case WM_EXITSIZEMOVE
MyComboBox.SuppressSetText
End Select
MyBase.WndProc(m)
End Sub
Private Class MyComboBox
Inherits NativeWindow
Private Const WM_GETTEXTLENGTH As Integer = &HE
Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As IntPtr, ByVal hWnd2 As IntPtr, ByVal lpsz1 As String, ByVal lpsz2 As String) As IntPtr
Public Shared SuppressSetText As Boolean = False
Public Sub New(ByVal cb As ComboBox)
Dim editWnd As IntPtr = FindWindowEx(cb.Handle, IntPtr.Zero, "Edit", vbNullString)
If Not editWnd.Equals(IntPtr.Zero
Me.AssignHandle(editWnd)
End If
End Sub
Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Messa
If MyComboBox.SuppressSetText
Select Case m.Msg
Case WM_GETTEXTLENGTH
Return ' Suprress the message
End Select
End If
MyBase.WndProc(m)
End Sub
End Class
End Class