Click here to Skip to main content
16,022,418 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi Folks

I want to enter the data into a text box and the entered data should appear immediately on the label as i move out of the text box.

I am entering a student mark in a text box i want the corresponding grade to immediately appear on the label.In my case the grade only appears after i click on submit button.

C# sample code

C#
int mark = Convert.ToInt32(TextBox1.Text);

if(mark>=80)//mark entered into TextBox 1
{ Label1.Text = "A"};//The grade to be displayed on the label immediately after typing.


Your help is highly appreciated
Posted
Updated 24-Jun-13 3:49am
v2
Comments
[no name] 24-Jun-13 10:59am    
You should use javascript for that..

$(textbox selector).blur(function () {
   switch statement to set the label...
});
 
Share this answer
 
Try something like this:
C#
private void textBox1_TextChanged(object sender, EventArgs e)
        {
            label1.Text = //assign text to label which you want to display.
        }
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900