Mega Code Archive

 
Categories / Visual C++ .NET / GUI Form
 

Display string on MessageBox

#include "stdafx.h" #using "System.Windows.Forms.dll" using namespace System; using namespace System::IO; using namespace System::Text; using namespace System::Windows::Forms; int main() {    StringWriter^ sw = gcnew StringWriter();    sw->WriteLine("asdf");    sw->Write("asdf\n");    sw->WriteLine();    String^ jambo = "asdf";    String^ s = String::Format("{0}, {1}.", jambo, jambo);    sw->WriteLine(s);    sw->Write("Make a wish, {0}, {0}.", jambo);    s = "asdf.\n";    String::Concat(s, "asdf?");    sw->WriteLine(s);    StringBuilder^ sb = gcnew StringBuilder();    sb->Append("asdf\n");    sw->WriteLine(sb);    // The resulting string might be displayed to the user in a GUI    MessageBox::Show(sw->ToString(), "Poetry", MessageBoxButtons::OK); }