Hello, I am trying to learn how to make a simple calculator in Visual Studio 2017.
I am following the instructions of a book, and I am trying to use Convert.ToInt32.
But when I do I get this error message: "Type name is now allowed".
I have googled and I read the microsoft reference on how to use it properly.
I do exactly as instructed in the book, and I seem to use it as I intended.
I would also like to know why I have to use the ^ sign when using string^.
But when I do I get this error message: "Type name is now allowed".
Why don't you post the verbatim error message? It is a lot more helpful than you doing it from memory.
I don't see an immediate problem with line 25. However, line 27 looks odd to me. You are trying to add an int to a string literal. This can't be done in normal C++, and probably not in your version of C++ either. textBox1->Text = sum + "+";
This is not standard C++, but Microsoft's C++/CLI. I have no idea what string^ means because that's Microsoft's custom thing. I would just google "C++ CLI string caret symbol".
It's definitely isn't the verbatim error message, especially since you misspelled "not" as "now". Does the error message really have no more information than that? Weird...
Sorry, I don't have C++/CLI on the computer I'm currently using, so I can't make an example project to test myself.
Maybe try making a new project yourself and making it as simple as you can possible make it while still reproducing the error message. Then, post the simplified source code that someone else could compile.
Oh, I see. By "error" you are only referring to the IntelliSense message. IntelliSense messages do not always give full context as to what the actual problem is!
If you actually go to Build -> Build Solution you'll see more errors pop up in the Error List.
Possible solution:
Change Convert.ToInt32(newNr);
to Convert::ToInt32(newNr);
. is used in C# and VB for static classes.
:: must be used in C++ for static classes.