Hello,
How do i select or set the focus of a particular cell in a datagridview? Actually, this problem is simple but it is hard for me to solve it coz i'm only a beginner in c#. So here is my sample list of students as shown below:

Ann
Antoinette
Bernadette
Brenda
Carole
Dean
Millicent
Ralph
Suzie
Victoria

During runtime the default cursor position will be at the top which is "Ann", So if i key in a letter or name in a textbox for example "s", automatically the cursor @ the datagrid will set to suzie so the output will be look like this:

Ann
Antoinette
Bernadette
Brenda
Carole
Dean
Millicent
Ralph
Suzie
Victoria

So the position of the cursor was changed and "Suzie" was selected, and if i key in another letter at the textbox automatically the cursor position will change and so on. I think it is still part of sorting in sql and it is very useful in windows environment. I need help for this problem.

Thank you very very much!

Har

You can use dataGridView.Rows[0].Cells[0].Selected = true; to select specific cells.
You will need to iterate through the cells and check their values against the textbox text to determine whether they should be selected or not.

Edited 6 Years Ago by Geekitygeek: n/a

Hello,

Thanks my problem was solved. Anyway, i found the best solution for that kind of selection, coz instead of using datagrid view, I found an alternative toolbox that fits to that problem through the use of Listbox, coz it has a features of key in selection that automatically scroll or select the cell or list without using any codes.

Thank you very very much!

This question has already been answered. Start a new discussion instead.