winform筛选数据

文章引自:
http://www.cnblogs.com/spgoal/archive/2006/09/04/494665.html

代码如下:

View Code
 string InputStr = tbKey.Text; 
            
foreach (DataGridViewRow dvr in dataGridView1 .Rows)
            {
                
if (dvr.Cells[0].Value.ToString().StartsWith(InputStr))
                {
                    dataGridView1.ClearSelection();
                    dvr.Selected 
= true;
                    dataGridView1.CurrentCell 
= dvr.Cells[1];
                    
break;
                }
            }

 

posted on 2011-07-25 17:12  wtq  阅读(599)  评论(0编辑  收藏  举报