View Single Post
 
Old July 20th, 2005, 09:47 AM
rodmcleay rodmcleay is offline
Friend of Wrox
Points: 2,376, Level: 20
Points: 2,376, Level: 20 Points: 2,376, Level: 20 Points: 2,376, Level: 20
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: , , Australia.
Posts: 596
Thanks: 1
Thanked 3 Times in 3 Posts
Default

You need to test the length of the text in the textbox
Your textbox has a 'Text' attribute, as well as others.
The Text is of the type 'string' and strings have many attributes, one of wich is Length.
You need to test that Length is greater than zero.
So if your Textbox is called TextBox1, in the onclick event of the button you test like so.

if(TextBox1.Text.Length <= 0)
{
//Show the message
MessageBox.Show("You Messaage");
}
else
{
//Do whatever else you wanted to do
}

I have ot used C# windows for a while so Im not sure syntax is exact, especially the messagebox.show bit.
But that should be a start.

======================================
They say, best men are molded out of faults,
And, for the most, become much more the better
For being a little bad.
======================================