0

i want to get input from a textbox in visual c++ 2010 window form application
i try this but it not work

    private: System::Void button1_Click(System::Object^  sender, System::EventArgs^  e) {
            std::string m;
                m==textBox1->Text;
                    MessageBox::Show("developed by basit  ");
             }
};

help me plzz

5
Contributors
6
Replies
28
Views
2 Years
Discussion Span
Last Post by ddanbe
0

try only putting textBox1.Text = "developed by basit "; without declaration of the string and without assigning value to it, if you want to show the text in the textBox

0

It's not working.

Well, you tell me what is wrong with my car, if I tell you this:"My car is not working."
Please specify WHAT is not working in your program.

Edited by ddanbe

0

i want to get input what is enter in textbox ,and save that input to variable and use it

1

m==textBox1->Text;

Two things:

  1. m is declared as std::string, while the Text property is declared as System::String^. The two types are not directly interchangeable.

  2. == does a comparison, not an assignment.

Also note that m only exists inside the event handler, so if you need it beyond that, it should probably be a private member or something.

Votes + Comments
Your indeed worth, to be called a "Code Sniper"
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.