From: keith on
Hello

I have a VC++ Express program with a form that has a text box and a button

When the button is clicked, I want to take the text box information and do
something with it. But what coding steps are necessary to get the data out
of the text box when the button has an onclick event? I've looked in the
documentation, read my VC++ book, and either I'm missing something or these
resources just don't talk about that. Can anyone offer an idea or point me
in the direction of a solution?

Thank you.

Keith



From: David Lowndes on
>I have a VC++ Express program with a form that has a text box and a button
>
>When the button is clicked, I want to take the text box information and do
>something with it. But what coding steps are necessary to get the data out
>of the text box when the button has an onclick event?

Keith,

Essentially all you have to do is access the control's text property
in the button click handler.

Dave
From: Tim Roberts on
keith <keith(a)discussions.microsoft.com> wrote:
>
>I have a VC++ Express program with a form that has a text box and a button
>
>When the button is clicked, I want to take the text box information and do
>something with it. But what coding steps are necessary to get the data out
>of the text box when the button has an onclick event? I�ve looked in the
>documentation, read my VC++ book, and either I�m missing something or these
>resources just don�t talk about that. Can anyone offer an idea or point me
>in the direction of a solution?

At the very lowest level, this is done by sending a WM_GETTEXT message to
the edit control. However, there are lots of wrappers for this. At the
raw API leve, there's GetDlgItemText. In ATL and MFC, there are wrappers
that return the contents in a CString.

So, as always, "it depends".
--
Tim Roberts, timr(a)probo.com
Providenza & Boekelheide, Inc.