当文本框验证失败时,更改文本框forecolor [英] when textbox validation fails change the textbox forecolor

查看:82
本文介绍了当文本框验证失败时,更改文本框forecolor的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的代码如下



studentid 10(textbox1)添加(按钮)

列表框



当用户输入studentid 10并单击添加按钮10时,studentid将显示在列表框中。



然后再次输入相同的学生ID 10,然后点击添加按钮,在标签中显示消息。



studentid 10已经存在。





i想要在用户输入相同的学生ID时显示不同颜色的studentid 10并单击添加按钮。



我可以用不同颜色显示学生ID 10.



我怎样才能在asp.net中使用c#。

My code as follows

studentid 10(textbox1) Add(Button)
Listbox

When user type the studentid 10 and click the add button 10 studentid will be displayed in the listbox.

Then again type the same student id 10 and click the add button shows the message in label.

The studentid 10 is already exists.


i want to show the studentid 10 in different colors when user type the same student id and click the add button.

for that how can i display the student id 10 in different color.

for that how can i do in asp.net using c#.

推荐答案

您可以生成一个随机数,您可以将其用作颜色代码。因此,可以在显示错误时更改颜色。
you can generate a random number and you can use that as the color code. So, the color can be changed on showing the error.


这篇关于当文本框验证失败时,更改文本框forecolor的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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