If statement problems

Hi, I'm very new to the C# community I have been working on a program that uses username recongnicition and I have a question. Here is my code


if (textBox1.Value == "mittensonfire")
            {
                MessageBox.Show("You are very leet");
            }
            else
            {
                MessageBox.Show("You are very gay");
            } 

 



Answer this question

If statement problems

  • RobertG1

    C# is case-sensitive so it should be Text and not text.
    Check the code snippet below:


    if (textBox1.Text == "mittensonfire")

    {

    MessageBox.Show("You are very leet");

    }

    else

     

    {

    MessageBox.Show("You are very gay");

    }


     

    Regards,
    Vikram



  • Mifuyne

    I'm not near a Development machine but I'm pretty sure the textbox doesn't have a value property.  I think what you are trying to do is "textBox1.Text =="

    Tom


  • Argonautic

    Thanks a whole bunch i forgot about that that.

  • Nate52

    It says  Error    1    'System.Windows.Forms.TextBox' does not contain a definition for 'text'  

  • ghazi

    If you make such mistake, Visual studio 2003 or 2005 can give you the tip immediately.

  • If statement problems