【问题标题】:Selected Value appear in the gridview选定的值出现在网格视图中
【发布时间】:2011-10-13 10:15:19
【问题描述】:
使用 VB.Net(Windows 应用程序)
网格视图和文本框
当我在文本框中输入数字或字符时,该值应在网格视图中闪烁。
例如,
GridView 有
ID Name
001 Jagan
002 Raman
003 Antony
........
。
输入以下数据时,
Textbox1.text = 01(那么 ID:001 应该在 Gridview 中闪烁),
Textbox1.text =Raman(然后 Name: Raman 应该在 Gridview 中闪烁)
我该怎么做?
需要 VB.Net 代码。请帮忙。
【问题讨论】:
标签:
vb.net
winforms
gridview
grid
【解决方案1】:
非常简单。在表单中添加计时器,将其间隔设置为 100 毫秒,然后在 timer1_Tick 事件中切换文本框外观,如下所示。
int flag = 1;
private void timer1_Tick(object sender, EventArgs e)
{
if (flag == 1)
{
textBox1.ForeColor = Color.Blue;
textBox1.Font = new Font("Tahoma", 9, FontStyle.Bold);
textBox1.BackColor = Color.WhiteSmoke;
flag = 2;
}
else
{
textBox1.ForeColor = Color.Black;
textBox1.Font = new Font("Tahoma", 9, FontStyle.Regular);
textBox1.BackColor = Color.White;
flag = 1;
}
}
您可以应用更具体的设计风格,让您的文本框的文本闪烁。