Search datagridview on user keypress

前端 未结 5 1270
别跟我提以往
别跟我提以往 2021-02-09 05:09

I\'m trying to select the first row where the cell value starts with the same keychar the user pressed. That\'s the part that is giving me trouble.

Here\'s how I\'m hand

5条回答
  •  傲寒
    傲寒 (楼主)
    2021-02-09 05:19

    Might be a case issue, is the Value in Cells["Name"] start with a capital letter? Try using ToUpper or ToLower on both; or you could try StartsWith(e.KeyChar, true) to ignoreCase. If you are trying to select the row, you'll want to do dataGridView1.Rows[i].Selected = true

提交回复
热议问题