+4 امتیاز

سلام به همه ...

من با این کد تو گریدویو جستجو رو انجام میدم :

private int searchIndex = -1;
        private void buttonX1_Click(object sender, EventArgs e) // جستجو در در گریدویو
        {
            buttonX1.Text = "یافتن بعدی";
            try
            {
                for (int i = 0; i < dataGridView1.Rows.Count; i++)
                {
                    searchIndex = (searchIndex + 1) % dataGridView1.Rows.Count;
                    DataGridViewRow row = dataGridView1.Rows[searchIndex];
                    if (row.Cells[1].Value == null)
                    {
                        continue;
                    }
                    if (row.Cells[1].Value.ToString().Trim().StartsWith(Txt_Software.Text) || row.Cells[1].Value.ToString().Trim().Contains(Txt_Software.Text))
                    {
                        dataGridView1.CurrentCell = row.Cells[1];
                        dataGridView1.FirstDisplayedScrollingRowIndex = dataGridView1.Rows[row.Index].Index;
                        row = dataGridView1.Rows[i];
                        return;
                    }
                }
            }
            catch { }
        }

منتها یه مشکل داره ... بین کلمات انگلیسی ، حروف کوچیک و بزرگ فرق میزاره !

چیکار کنم که فرقی نباشه !؟

بسته شده

1 پاسخ

+6 امتیاز
 
بهترین پاسخ

سلام بجای

.ToString().Trim()

از

.ToString().Trim().ToLower()

استفاده کن

سوال جدید

2,337 سوال

2,871 پاسخ

3,725 دیدگاه

3,921 کاربر

دسته بندی ها

...