How to correct my null exception??
        Posted  
        
            by 
                kostas
            
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by kostas
        
        
        
        Published on 2011-02-06T23:09:27Z
        Indexed on 
            2011/02/06
            23:25 UTC
        
        
        Read the original article
        Hit count: 479
        
hi!i have created a contact form using c# and web services.i would like to get an alert message if the user hasnt filled his name or when his name is a number.this is my c# code:
public partial class Default2 : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        Validation.WebService validate = new Validation.WebService();
        bool ismail = validate.isEmail(TextBox2.Text);
        if (!ismail)
          { Label1.Text = "your mail is wrong!!"; }
        Validation.nameVal valid = new Validation.nameVal();
        bool isname = valid.isName(TextBox1.Text);
        if (!isname )
        { Label2.Text = "Your name is wrong!!"; }
        else if (isname==null)
        { Label2.Text = "Please fill in your name"; }
        if (isname && ismail)
        {  
            { Label1.Text = null; Label2.Text = null;
            Label3.Text = "Your message has been send!";}
            }
        }
}
with this code i have a null exception..
© Stack Overflow or respective owner