Hi all,
i just started playing with gui apps. My first test is a small ping app.
I've created a new project (windows forms) containing:
1: image
2: textbox
3: 2 x button (1 exit, 1 ping)
Now when i click on exit, the app extits... "really "
When i click on ping, i''m getting a popup with the information from the textfield. This is cool, but i want to run the system command ping with the textbox value.
This is what i have:
Code:
#pragma endregion
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {
Application::Exit();
}
private: System::Void button2_Click(System::Object^ sender, System::EventArgs^ e) {
String^ result = textBox1->Text;
MessageBox::Show( result );
////////////// When i comment the messagebox and try:
system("ping -n 2 " + result + " > C:\\pingtest.txt");
////////////// i get errors (shown below)
}
private: System::Void textBox1_TextChanged(System::Object^ sender, System::EventArgs^ e) {
}
};
ERROR:
Code:
error C2664: 'system' : cannot convert parameter 1 from 'System::String ^' to 'const char *'
Only with:
Code:
private: System::Void button2_Click(System::Object^ sender, System::EventArgs^ e) {
system("ping -n 2 www.google.nl > C:\\pingtest.txt");
}
it does work, but i can't use the textbox value.
So i need to convert "result" i think, but i don't know how to do this correctly and let ping run with the result as parameter
Any ideas ?