0

H! There!

I have a problem in c# that require sorting of names of students in a sql database and i want it to be specific, i used data grid view to view the data of the students as shown below:

Students First Name:

Ann
Antoinette
Bernadette
Brenda
Jeannette
Judith
Lester
Santos
Sebastien
Suzie
Tim
Victoria

if i type in a letter or abbreviation @ a textbox1 for example "s", all Names that starts with letter s will be sorted first so the output now of the query will become:

Students First Name:

Santos
Sebastien
Suzie
Ann
Antoinette
Bernadette
Brenda
Jeannette
Judith
Lester
Tim
Victoria

So if i type j, all starts with j will be first and so on.

I need help for this problem coz it is so hard for me to output the students with this kind of sorting.

thanks in advance.

Hardz

2
Contributors
2
Replies
4
Views
6 Years
Discussion Span
Last Post by Hardz
0

Ok, well it's simply a matter of iterating through your data and finding the words beginning with the letters you type and moving them (NOT copy), probably into a separate array for safe keeping. Re-organise your old array alphabetically, then insert your separate array back into the old array at the beginning.

There's probably an easier way but I'm tired and it's hard to think properly :P

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.