在文本框中输入数据并立即显示在标签上 [英] Entering data in textbox and display on label immediately

查看:174
本文介绍了在文本框中输入数据并立即显示在标签上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hi Folks



我想将数据输入文本框,当我移出文本框时,输入的数据应立即出现在标签上。



我在文本框中输入学生标记我希望相应的成绩立即出现在标签上。在我的情况下,成绩仅在我点击提交后出现按钮。



C#示例代码



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

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

推荐答案


(文本框选择器).blur(function(){
用于设置标签的开关语句...
});
(textbox selector).blur(function () { switch statement to set the label... });


尝试这样的事情:

Try something like this:
private void textBox1_TextChanged(object sender, EventArgs e)
        {
            label1.Text = //assign text to label which you want to display.
        }


这篇关于在文本框中输入数据并立即显示在标签上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆