Hello! I'm trying to make a simple calculator in Visual C++ and while coding the decimal button, I encountered the error C2228.
Basically, I'm checking if the textBox1 (its name!) already contains a '.'; if yes, then it should return; else, it'll add a '.'.
To check for that, I use:
private: System::Void button18_Click(System::Object^ sender, System::EventArgs^ e) {
if (textBox1->Text.Contains("."))
{
return;
}
else
{
textBox1->Text = textBox1->Text + ".";
}
Any ideas?
Here's a picture:
http://i26.tinypic.com/24y9qqe.png
Thank you, forum! :)