My question is about calling simple functions with the line beneath in Visual Studio (using Visual C++)
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {
I'm starting C++ playing around with simple console functions.
I realize the importance of learning the basics with basic console functions,
but I want to play around a bit in Visual Studio, and not with just plain console screens.
Using Visual C++, I can compile a simple working windows form application with a single button (for example a message box).
I simply draw a button on the form, double click in it, and add the following line to the button:
MessageBox::Show("Hello New World");
After I paste it in it looks like this of course (and it works tip top):
#pragma endregion
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {
MessageBox::Show("Hello New World");
}
};
}
However, if I were to drop this code beneath in the same place (as I did with the message box code), I receive an error..
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
ofstream outputFile;
outputFile.open("C:\\Users\\Anonymous\\Desktop\\Write To Me.txt");
// Write 3 great names to the file
outputFile << "Bach\n";
outputFile << "Beethoven\n";
outputFile << "Mozart\n";
// Close the file
outputFile.close();
return 0;
}
Note: this code works tip top by itself as a windows console simple app (I simply pasted it in using Dev-C++ and compiled it)
Forgive my ignorance, but every book I read keeps teaching me C++ console stuff.
My guess is the header files are supposed to be placed somewhere else?
Or perhaps this function all together should be placed elsewhere as the
Which is good! : ), but how do I apply these functions to buttons in a C++ windows form application?
Any help is super appreciated

New Topic/Question
Reply



MultiQuote





|