当用户从一个文本框导航到另一个文本框而不输入任何输入时,文本框颜色应更改. [英] Text box color should change when user navigating from one textbox to another text box without entering any input.

查看:90
本文介绍了当用户从一个文本框导航到另一个文本框而不输入任何输入时,文本框颜色应更改.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我正在使用dotnet framework 4.0,asp.net和C#.我的问题是当用户通过自动按Tab键从一个文本框导航到另一个文本框时,导航后的文本框颜色应发生变化",为此请帮助我解决此问题.


在此先感谢..

解决方案

在文本框的焦点事件中,使用background color属性并提供您选择的颜色.

在第一个文本框的LostFocus 事件上编写代码.

例如

textbox1_LostFocus(sender e, LostFocusEventArgs e)
{
  if (textbox1.text.Length == 0)
  {
     textbox1.Background = Color.Yellow;
  }
}


HI All,

I am using dotnet framework 4.0 and asp.net and C#. My question is "when user navigates from one text box to another text box by pressing tab automatically the the navigated text box color should change" for this plz help me to solve this problem.


Thanks in advance..

解决方案

In the text-box''s on-focus event use the background color property and give a color of Your choice.


Write code on the LostFocus event of the first textbox.

For e.g.

textbox1_LostFocus(sender e, LostFocusEventArgs e)
{
  if (textbox1.text.Length == 0)
  {
     textbox1.Background = Color.Yellow;
  }
}


这篇关于当用户从一个文本框导航到另一个文本框而不输入任何输入时,文本框颜色应更改.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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