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

Recommended Answers

All 6 Replies

didnt get it. you want input or output from your pgm? please tell what you expect from work/.

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

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.

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

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.

commented: Your indeed worth, to be called a "Code Sniper" +15

Oops, Your should be You're of course!

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.