Enabling a password char for a combobox control
Enabling a password char for a combobox control <URL:http://dotnet.mvps.org/dotnet/faqs/?id=comboboxpasswordchar&lang=en> ---------------------------------------------------------------------------- Enabling a password char for a combobox control Comboboxes with 'DropDownStyle' set to 'DropDown' do not support a password char for the edit part in Windows Forms of .NET 1.1. 'SetComboBoxPasswordChar' provides a method to set a combobox's password char. \\\ Private Declare Auto Function GetWindow Lib "user32.dll" ( _ ByVal hWnd As IntPtr, _ ByVal wCmd As Int32 _ ) As IntPtr Private Declare Auto Function SendMessage Lib "user32.dll" ( _ ByVal hWnd As IntPtr, _ ByVal wMsg As Int32, _ ByVal wParam As IntPtr, _ ByVal lParam As IntPtr _ ) As IntPtr Private Const EM_SETPASSWORDCHAR As Int32 = &HCC Private Const GW_CHILD As Int32 = 5 Private Sub SetComboBoxPasswordChar( _ ByVal ComboBox As ComboBox, _ ByVal PasswordChar As Char _ ) SendMessage( _ GetWindow( _ ComboBox.Handle, _ GW_CHILD _ ), _ EM_SETPASSWORDCHAR, _ New IntPtr(AscW(PasswordChar)), _ IntPtr.Zero _ ) ComboBox.Refresh() End Sub /// Usage: \\\ SetComboBoxPasswordChar(Me.ComboBox1, "*"c) ///