Page 1 of 1

If statement for the richTextBox1!

Posted: Thu Jun 23, 2011 7:23 am
by emreozpalamutcu
Hi,
I have this richTextBox1 and when users enter something there and click send email will come to me, then I question came to my had what if they send empty message, i don't get the message if it's empty but what should make them think that they are spamming me when their not. So my question is when the richTextBox1 is empty, no text is written then message box will say please enter your message. or a another message that makes more sense.

Thank you.

Re: If statement for the richTextBox1!

Posted: Thu Jun 23, 2011 8:34 am
by MrAksel
Code: Select all
If String.IsNullOrWhiteSpace(RichTextBox1.Text) Then
   'No text or only space
   MsgBox("Please enter a valid message")
Else
   'There is a valid message, send the mail
End If
Im sorry that this is in VB.Net, but i dont know a be*p about C++

Re: If statement for the richTextBox1!

Posted: Thu Jun 23, 2011 8:55 am
by emreozpalamutcu
Thank you but that didn't really help, I done VB before if i knew that would of worked i would of tried it, C# and C++ is similar, but visual basic is almost a different thing. But thanks for the help, it's enough to thought to help. Some people knows the answer they can't be bothered answering.

Re: If statement for the richTextBox1!

Posted: Thu Jun 23, 2011 9:15 am
by Snyper345
emreozpalamutcu wrote:
Thank you but that didn't really help, I done VB before if i knew that would of worked i would of tried it, C# and C++ is similar, but visual basic is almost a different thing. But thanks for the help, it's enough to thought to help. Some people knows the answer they can't be bothered answering.
its not that people cant be bothered its that barely anyone on here knows C++ just wait a day and if you do not have a reply i would use google :P

Re: If statement for the richTextBox1!

Posted: Thu Jun 23, 2011 9:19 am
by emreozpalamutcu
lol I almost done it, I had a idea and it's kind of working just having trouble with end if and I will search that on Google :D

Re: If statement for the richTextBox1!

Posted: Thu Jun 23, 2011 9:44 am
by emreozpalamutcu
Code: Select all
 if (richTextBox1->Text=="")
{

MessageBox::Show("Please enter your message!", "empty", MessageBoxButtons::OK, MessageBoxIcon::Exclamation);

} 

 else

{

//second action here

}
This is was the code I needed.