ExclamationSolvedVS 2012 C++ Windows Form Applications help

Posts 1–5 of 5 · Page 1 of 1
VS 2012 C++ Windows Form Applications help
I'm trying to debug my little program here, but it's failing to do so. It says it has build errors.
I don't know what to fix in my code. It's just a simple if statement, and I don't know why this error keeps popping up, even though I've read the error myself. When I delete this if statement, all goes well.

Screenshot of my code:


Screenshot of the error:
Why not use IsNullOrEmpty ?

Code:
if(String::IsNullOrEmpty(richTextBox1->Text))
{
    MessageBox::Show("Short");
}
And after the messagebox has popped up. It'll still continue with the program so the check is rather useless.
Quote Originally Posted by Magnificient View Post
Why not use IsNullOrEmpty ?
Could you just briefly explain in easy words what IsNullorEmpty means? Or just what Null means?
richTextBox1_TextChanged method is missing, you probably subscribed to the event but deleted the function and it's still there in InitializeComponent or whatever.

You need to remove the line which looks something like this:
richTextBox1->TextChanged += gcnew System::EventHandler(this, &Form1::richTextBox1_TextChanged);

Quote Originally Posted by Magnificient View Post
Why not use IsNullOrEmpty ?

Code:
if(String::IsNullOrEmpty(richTextBox1->Text))
{
    MessageBox::Show("Short");
}
And after the messagebox has popped up. It'll still continue with the program so the check is rather useless.
TextLength will save the overhead of obtaining the text buffer and then converting it to a .NET string.
Quote Originally Posted by master131 View Post
richTextBox1_TextChanged method is missing, you probably subscribed to the event but deleted the function and it's still there in InitializeComponent or whatever.

You need to remove the line which looks something like this:
richTextBox1->TextChanged += gcnew System::EventHandler(this, &Form1::richTextBox1_TextChanged);
Thanks. That fixed the problem and now it's running fine.
You can close this.
Posts 1–5 of 5 · Page 1 of 1
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Talk with us