all groups > vb.net controls > october 2005 >
You're in the

vb.net controls

group:

PasswordChar in Combobox


PasswordChar in Combobox Turtle
10/14/2005 5:25:04 PM
vb.net controls:
I was delighted to find Herfried K. Wagner's code to set a combobox's
passwordchar at
http://dotnet.mvps.org/dotnet/faqs/?id=comboboxpasswordchar&lang=en.

It looked like the answer to my problem - a combobox where I (sometimes)
needed to display a password.

Sadly, when I implemented the code, the combobox still displayed text.

I'm rather a novice programmer when it comes to API calls like SendMessage -
is there something obvious I might be missing? (e.g. will this only work
when the control is being created?)
I realize I haven't given you much to go on here -
I'd gladly supply more information, if only I knew what would help.
Here are a few items which may be relevant:
I'm coding in VB.NET v.1.1.
The combobox's DropDownStyle is set to Simple before I call this code.

TIA
- Turtle

Re: PasswordChar in Combobox Herfried K. Wagner [MVP]
10/14/2005 11:44:07 PM
"Turtle" <macdermott@nowhere.com> schrieb:
[quoted text, click to view]

I assume the code will only work if 'DropDownStyle' is set to
'DropDownList'.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>
Re: PasswordChar in Combobox Turtle
10/17/2005 12:00:00 AM
Vielen Dank, Herr Wagner!

That does seem to be the problem.
I'd really like, however, to be able to use a combobox with Simple drop-down
style (in essence, a combobox which looks just like a textbox) with a
password character. Is there no hope?


[quoted text, click to view]

Re: PasswordChar in Combobox Jan Erik Karlsen
9/26/2006 5:51:10 AM
Try using SendMessage(GetWindow(GetWindow(ComboBox.Handle, GW_CHILD),
GW_HWNDNEXT), EM_SETPASSWORDCHAR, AscW(PasswordChar), 0) in function
SetComboBoxPasswordChar to get Edit part of the combobox. Otherwise you
get the ListBox part of the combobox.

Jan Erik Karlsen
Senior Systems Engineer
Visma Software ASA
Norway

AddThis Social Bookmark Button