hello every one
i am making a program what requires that the user types in some text in a textbox.
the problem is, how do i get that text from the textbox into the std::string (or a other kind of string)?
i don't know how to do that in Win32, which i am using.

i had already tried to use the GetDlgItemText() function (and similar functions), but i don't know how to use that function, because i am not that good at C++. i don't know where and how to use that function.


i am using Microsoft Visual Studio 2010,
i am not using a windows form.

Hi, you have to use visual studio?

Because I'm using wxDev-C++, and in this plataform is easy to do what you want, since this is a "delphi" based plataform, making the user interface cool and easy handling.

If you can use wxDev-C++ I could help you.

Bye

I haven't done much of Win32 Programming. But am a bit familiar with it.
I assume that the text member-variable in the TextBox element stores the text.

System::Sting val=text_box->text;

Now val holds the value of the textbox, but not in the std::string but instead, System::String.

Now to convert this into the std::string, you could use something known as a Marshal,which can be a bit more complicated.

but what if i got more than one textbox?
or is text_box the handle to the textbox window?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.