示例#1
0
 private void toolStripFind_Click(object sender, EventArgs e)
 {
     using (FindForm form = new FindForm())
     {
         form.RowIndex  = 0;
         form.Value     = _lastFindString;
         form.FindNext += new EventHandler(form_FindNext);
         form.ShowDialog();
     }
 }
示例#2
0
        void form_FindNext(object sender, EventArgs e)
        {
            FindForm form = (FindForm)((Button)sender).Parent;

            for (int index = form.RowIndex; index < dataGridView1.Rows.Count; index++)
            {
                string text = dataGridView1.Rows[index].Cells[1].Value.ToString();
                if (text.StartsWith(form.Value))
                {
                    _lastFindString           = form.Value;
                    form.RowIndex             = index + 1;
                    dataGridView1.CurrentCell = dataGridView1.Rows[index].Cells[1];
                    return;
                }
            }
            form.RowIndex = 0;
            MessageBox.Show("Passed the end of the table.", "Information",
                            MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
示例#3
0
 private void toolStripFind_Click(object sender, EventArgs e)
 {
     using (FindForm form = new FindForm())
     {
         form.RowIndex = 0;
         form.Value = _lastFindString;
         form.FindNext += new EventHandler(form_FindNext);
         form.ShowDialog();
     }
 }