• Top Members
    Reps
    Posts
  • 834 Replies
    2585 Replies
  • 716 Replies
    2026 Replies
  • 331 Replies
    1928 Replies

If statement for the richTextBox1!

User avatar
emreozpalamutcu
New Member
Posts: 15

If statement for the richTextBox1!

Thu Jun 23, 2011 8:23 am

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
Posts: 1758

Re: If statement for the richTextBox1!

Thu Jun 23, 2011 9:34 am

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
Posts: 15

Re: If statement for the richTextBox1!

Thu Jun 23, 2011 9:55 am

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
Posts: 471

Re: If statement for the richTextBox1!

Thu Jun 23, 2011 10:15 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
Posts: 15

Re: If statement for the richTextBox1!

Thu Jun 23, 2011 10:19 am

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
Posts: 15

Re: If statement for the richTextBox1!

Thu Jun 23, 2011 10:44 am

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.

Post Reply

Return to “General coding help”