By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,680 Members | 1,436 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,680 IT Pros & Developers. It's quick & easy.

Obtain textbox control in combobox

P: n/a
How can I obtain the textbox (editing field) control of the combobox? I tried
combobox.Controls to obtain the collection of controls that the combobox
contains but it turned out to be empty. Thanks.
Nov 16 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
Hi,

What would you do with the obtained textbox? There just might be a better
approach to solve the original problem...

--
Sincerely,
Dmitriy Lapshin [C# / .NET MVP]
Bring the power of unit testing to the VS .NET IDE today!
http://www.x-unity.net/teststudio.aspx

"Quan Nguyen" <Qu********@discussions.microsoft.com> wrote in message
news:12**********************************@microsof t.com...
How can I obtain the textbox (editing field) control of the combobox? I
tried
combobox.Controls to obtain the collection of controls that the combobox
contains but it turned out to be empty. Thanks.


Nov 16 '05 #2

P: n/a
Quan,

Can you explain more, because the textbox of the combobox is just by
instance combobox1.text

Cor

"Quan Nguyen" <Qu********@discussions.microsoft.com>
How can I obtain the textbox (editing field) control of the combobox? I
tried
combobox.Controls to obtain the collection of controls that the combobox
contains but it turned out to be empty. Thanks.

Nov 16 '05 #3

P: n/a
Hi,

The combobox is a native control, it does not have any controls inside of
it.

What do u want to do anyway?

What you may do is intercept what is written in that textbox with an event.

cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"Quan Nguyen" <Qu********@discussions.microsoft.com> wrote in message
news:12**********************************@microsof t.com...
How can I obtain the textbox (editing field) control of the combobox? I
tried
combobox.Controls to obtain the collection of controls that the combobox
contains but it turned out to be empty. Thanks.

Nov 16 '05 #4

P: n/a
Hi,

What you may do is extend the Combobox class

What the documentation refer is that the combobox works "like" a
combination of those two controls.

also you could create your own control, take a look at www.opennetcf.org
they have an ownerdrawcontrol that will give you ideas

Cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Quan Nguyen" <Qu********@discussions.microsoft.com> wrote in message
news:4B**********************************@microsof t.com...
The documentation says the combobox is composed of a textbox and a
listbox,
so I thought I could extract the textbox control out of the combobox for
use.
Actually, I'm trying to integrate a class library which enables input of
Vietnamese characters in TextBoxBase-derived controls
(http://vietpad.sourceforge.net/library.html). Since the handler accepts
only
TextBoxBase control as parameters, I would like to get the textbox control
of
the combobox. Is this possible or there is another approach to this?
Thanks.

Nov 16 '05 #5

P: n/a
Actually, you're both correct. A combobox is indeed a core Window control,
but it is internally made up of three separate windows: the combo box window
itself, the edit control, and the drop-down list control. The edit control
and list control may or may not exist, depending on the combo-box style (see
ms-help://MS.MSDNQTR.2004APR.1033/shellcc/platform/commctls/comboboxes/aboutcomboboxes.htm
for more detail on this). The thing is that these controls are Windows
controls, and not .NET controls. Therefore we deal in HWNDs and not Control
subtypes.

In order to get the HWND of the edit control of a combo box, you must use
the SendMessage Windows API call to send the CB_GETCOMBOBOXINFO message to
the combo box control. The COMBOBOXINFO structure returned by this call will
contain the edit controls HWND in its hwndItem field.

However, before you get excited, there's one huge problem which is that an
HWND to an edit box cannot be converted into a TextBoxBase, at least not as
far as I know.

"Ignacio Machin ( .NET/ C# MVP )" <ignacio.machin AT dot.state.fl.us> wrote
in message news:uh**************@TK2MSFTNGP12.phx.gbl...
Hi,

What you may do is extend the Combobox class

What the documentation refer is that the combobox works "like" a
combination of those two controls.

also you could create your own control, take a look at www.opennetcf.org
they have an ownerdrawcontrol that will give you ideas

Cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Quan Nguyen" <Qu********@discussions.microsoft.com> wrote in message
news:4B**********************************@microsof t.com...
The documentation says the combobox is composed of a textbox and a
listbox,
so I thought I could extract the textbox control out of the combobox for
use.
Actually, I'm trying to integrate a class library which enables input of
Vietnamese characters in TextBoxBase-derived controls
(http://vietpad.sourceforge.net/library.html). Since the handler accepts
only
TextBoxBase control as parameters, I would like to get the textbox
control of
the combobox. Is this possible or there is another approach to this?
Thanks.


Nov 16 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.