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! :)

Thank you for your input, Danny_501.
However - after some trial and error - I finally got it. And it works well! :D

For future references,

private: System::Void button18_Click(System::Object^  sender, System::EventArgs^  e) {
			 if (textBox1->Text->Contains("."))
			 {
				 return;
			 }  
			 else
			 {
				 textBox1->Text = textBox1->Text + ".";
			 }
		 }

Basically, no '.'s in C++. :P

oh lol. As I said I'm not familiar with Visual C++. Have only used Unix compilers all my programming life (except for assignments :P).

This article has been dead for over six months. Start a new discussion instead.