-
No. C++/CLI is not an extension! It's a new language that cares strongly about backwards compatibility to C++.
Stringer: no offence, but you apparently don't really understand scoping or classes. Please, do yourself a favour and learn the basics of C++ first. Then, if you really, really need to, you can learn C++/CLI. The way you're doing it now, you'll only get confused and write code that will eventually be featured on http://www.thedailywtf.com/ . It is the wrong approach.
-
after some messing around with everything I figured out how to change the label text by putting the form1 class constructor in the source file.
But the only way I can figure out how to do an action when a button is clicked is to make another class and have a switch in it so when a button is clicked it passes an int value to the switch to identify which button was clicked and then put whatever code I want in the case. This seems kind of jerryrigged(better word?) to me though, I dont think I should have to have another class that has to sort out which button was clicked and then do whatever
-
No you shouldn't. The button_Clicked method is passed an event object, which contains a reference to the button that was clicked.
I wish you would have followed my advice. Then you wouldn't have to ask questions like this.
-
ok your right, I just had to declare my functions in the header file and everything worked like that.
I just want to finish this one program im making and then learn everything the right way later, I know it sounds stupid but im determined
so I got the button click stuff figured out, now im just trying to dynamically change the text of a label. My problem with this is that I need to use "sprintf" to create a string but I cant pass that string to the label's text because it requires a System::String^ object. So how can I get the contents of a character array string to a System::String^ object?
-
-
Don't use sprintf. Use Format instead. I forgot which class it is part of. That way, you're always working with System::String.