Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
发生捕获错误时如何将文本框突出显示为红色?我所指的错误是在 try and catch 中。我想突出显示最有可能有错误条目的文本框红色。例如,当用户输入错误的数据类型然后发生错误时,我希望这些文本框以红色突出显示。
如果您使用的是 windows 窗体,它应该像这样简单:
try { //your exception here } catch (Exception) { yourLabel.BackColor = Color.Red; }
这将改变背景颜色。不确定这是否足以“突出显示”。