If statement for the richTextBox1!

Post your questions regarding programming in C++ in here.
6 posts Page 1 of 1
Contributors
User avatar
emreozpalamutcu
New Member
New Member
Posts: 15
Joined: Wed Jun 22, 2011 6:43 pm

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.
User avatar
MrAksel
C# Coder
C# Coder
Posts: 1758
Joined: Fri Mar 26, 2010 12:27 pm

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++
LMAOSHMSFOAIDMT
Laughing my a** of so hard my sombrero fell off and I dropped my taco lmao;


Over 30 projects with source code!
Please give reputation to helpful members!

Image
Image
User avatar
emreozpalamutcu
New Member
New Member
Posts: 15
Joined: Wed Jun 22, 2011 6:43 pm

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.
User avatar
Snyper345
VIP - Donator
VIP - Donator
Posts: 471
Joined: Mon Nov 01, 2010 1:53 am

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
Image
Image
User avatar
emreozpalamutcu
New Member
New Member
Posts: 15
Joined: Wed Jun 22, 2011 6:43 pm

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
User avatar
emreozpalamutcu
New Member
New Member
Posts: 15
Joined: Wed Jun 22, 2011 6:43 pm

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.
6 posts Page 1 of 1
Return to “General coding help”