winform技巧一,errorprovider,任务栏可见,总在最前
2008-05-25 13:48 Virus-BeautyCode 阅读(1351) 评论(0) 编辑 收藏 举报![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/ExpandedBlockStart.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/ExpandedBlockEnd.gif)
private void textBox1_Validating(object sender, CancelEventArgs e)
{
if (textBox1.TextLength < 5)
{
errorProvider1.SetError((Control)sender, "input must more than 5.");
textBox1.SelectAll();
e.Cancel = true;
}
else
{
errorProvider1.SetError((Control)sender, "");
}
}
private void button1_Click(object sender, EventArgs e)
{
for (int i = 1; i < 1000; i++)
{
this.progressBar1.Value++;
this.label1.Refresh();this.label1.Text = Convert.ToString(progressBar1.Value);
}
}