I'm assuming you selected a CLR/Winforms application in VC++. If you want to make a standard C++ program select Win32 Console Application instead. The CLR implementation of C++ (C++/CLI) relies on the .NET libraries and a slightly different syntax (as you're finding with the "ref class" keyword. There are a few good sites out there like http://www.functionx.com/vccli/index.htm but honestly if you want to do .NET programming and you're just starting again you're probably better off with C#, IMHO.
by jonsca: n/a
Yeah, I selected a winforms app. Then added a class to it.
Just trying to get some C++ syntax on a function and procedure.
I program in C# and vb.net. So you won't find me asking any questions about that. Just screwing aroung with C++.
Any syntax would be good for a standard function or procedure.
To have your class interact with the form, you need to send in an instance of the form:
public ref class ClassData
System::Windows::Forms::Form ^ frm1;
ClassData(System::Windows::Forms::Form ^ frm1);
Then declare an object of the class in the private variables section of Form1.h: ClassData ^ Cd; . Instantiate it in your Form1 constructor or wherever, passing in the form as "this". Then use it as you would any other object (so you can call Cd->ChangeButtonText();
by jonsca: n/a
I appreciate you responding, but i don't think you understand the simplicity of this question.
All I'm looking for is a sample function and a sample sub in a .h and a .cpp.
Take this for vb example
private function AnyFunction() as integer
private sub AnySub()
Im just tying to get that into C++ syntax in the .h and .cpp file that I posted first.
root = tkinter.Tk()
buttons=[i for i in range(10)]
#If specific button is pressed, output "YES"
for num in buttons: