Chris,

Object.Equals returns a boolean indicating whether or not the objects
have the same value (or reference depending on the object).

What you need to do is:

x = Convert.ToInt32(txtValue1.Text);

And likewise for "y". Change the "ToInt32" to whatever type of values
you are expecting to be entered.

Dino

-----Original Message-----
From: dotnet discussion [mailto:[EMAIL PROTECTED]] On Behalf Of
Chris Stewart
Sent: Monday, 22 April 2002 13:22
To: [EMAIL PROTECTED]
Subject: [DOTNET] Getting variables from a textbox


Hello all, I'm trying to get values entered into a textbox in my C# GUI.
I'd like to perform calculations on these values.  Here is what I have
so far.

****************************************************************

private void btnAdd_Click(object sender, System.EventArgs e)
{
        x.Equals(txtValue1.Text);
        y.Equals(txtValue2.Text);

        total = x + y;

        Console.WriteLine(x);
        Console.WriteLine(y);

        total.ToString(lblDisplay.Text);

        lblDisplay.Refresh();
}

****************************************************************

Any ideas of what I'm doing wrong?

Regards,
Chris Stewart
[EMAIL PROTECTED]

You can read messages from the DOTNET archive, unsubscribe from DOTNET,
or subscribe to other DevelopMentor lists at http://discuss.develop.com.

---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.350 / Virus Database: 196 - Release Date: 17/04/2002


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.350 / Virus Database: 196 - Release Date: 17/04/2002

You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

Reply via email to