From: keith on
Hi Dave,
Thanks very much. That's what is puzzling me. Where can I take a look at
some sample code that does that?
keith

"David Lowndes" 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?
>
> Keith,
>
> Essentially all you have to do is access the control's text property
> in the button click handler.
>
> Dave
> .
>
From: David Lowndes on
>Thanks very much. That's what is puzzling me. Where can I take a look at
>some sample code that does that?

Almost anywhere I'd have thought.

What type of project are you working on?

I'd assume that since you mention it's the Express edition and you say
"form" that it's a Windows forms project, in which case it's usually
just something like this:

private: System::Void button1_Click(System::Object^ sender,
System::EventArgs^ e)
{
String ^ str = textBox1->Text;
...
}

Dave
From: keith on
Hi Dave,
thanks very much i inserted that text and it compiled without errors... now
I have to figure out where to go from there. I'm discovering for the second
time that I have much to learn about c++
Keith

"David Lowndes" wrote:

> >Thanks very much. That's what is puzzling me. Where can I take a look at
> >some sample code that does that?
>
> Almost anywhere I'd have thought.
>
> What type of project are you working on?
>
> I'd assume that since you mention it's the Express edition and you say
> "form" that it's a Windows forms project, in which case it's usually
> just something like this:
>
> private: System::Void button1_Click(System::Object^ sender,
> System::EventArgs^ e)
> {
> String ^ str = textBox1->Text;
> ...
> }
>
> Dave
> .
>
From: keith on
Hi Tim,
thanks very much. That is helpful information. As i said in my note to
Dave, I am discovering how much I have to learn about c++. It has so much
great potential.
Keith

"Tim Roberts" wrote:

> 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.
> .
>
From: Ulrich Eckhardt on
keith wrote:
> I'm discovering for the second time that I have much to learn about c++
[...]
>> private: System::Void button1_Click(System::Object^ sender,
>> System::EventArgs^ e)
>> {
>> String ^ str = textBox1->Text;
>> ...
>> }

This actually is not plain C++, but an MS dialect thereof. Also, this is not
just about using that language but also about using the APIs that some
libraries provide.

Uli


--
C++ FAQ: http://parashift.com/c++-faq-lite

Sator Laser GmbH
Geschäftsführer: Thorsten Föcking, Amtsgericht Hamburg HR B62 932