Hi all, i have a simple application which i couldnt run correctly. My codes;
--------------------------------------------------------
-------------------------------------------------------
When i run that page, and enter the same number with label1 to textbox1 and click to the button, first label1 changes to another number and so the comparement does not match.
Hope u can help me, thank you a lot..
--------------------------------------------------------
Code:
using System; using System.Collections.Generic; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; protected void Page_Load(object sender, EventArgs e) { Random r = new Random(); int myRandom = r.Next(1000, 9999); Label1.Text = myRandom.ToString(); } protected void Button1_Click(object sender, EventArgs e) { string mynumber = TextBox2.Text; if(mynumber == Label1.Text) Label2.Text = "Same Numbers."; else Label2.Text = "Different Numbers."; }
When i run that page, and enter the same number with label1 to textbox1 and click to the button, first label1 changes to another number and so the comparement does not match.
Hope u can help me, thank you a lot..
Comment