J
Jack Addington
I want to scroll through the alphabet in order to scroll some data to the
closest name that starts with a letter. If the user hits the H button then
it should scroll to the letter closest to H. If no one exists with H, then
go to I, etc. If its near the end, say 'V', and the last person is a 'T'
then it should work its way back up the alphabet. I was trying to loop as
if the Char's were ints but I am having problems
I have buttons with A .. Z that have the letter in the Tag field.
char key = button.Tag.ToString().ToCharArray(1,1)[0]; // get the letter
to search for ...
// work our way down the alphabet
while (row == 0 && (int)key <= (int)'Z') {
row = list.find (firstletter = key )
(int)key++;
}
// if we didn't find something at least lower than the button pressed
then try going up the alphabet
if (row==0) {
key = (char)(int)button.Tag.ToString().ToCharArray(1,1)[0] - 1;
// work our way up the alphabet
while (row == 0 && (int)key >= (int)"A") {
row = this.dwPatientList.FindRow("left(sorted_name,1)='" + key
+ "'",row,dwPatientList.RowCount);
(int)key--;
}
}
Scroll to row
closest name that starts with a letter. If the user hits the H button then
it should scroll to the letter closest to H. If no one exists with H, then
go to I, etc. If its near the end, say 'V', and the last person is a 'T'
then it should work its way back up the alphabet. I was trying to loop as
if the Char's were ints but I am having problems
I have buttons with A .. Z that have the letter in the Tag field.
char key = button.Tag.ToString().ToCharArray(1,1)[0]; // get the letter
to search for ...
// work our way down the alphabet
while (row == 0 && (int)key <= (int)'Z') {
row = list.find (firstletter = key )
(int)key++;
}
// if we didn't find something at least lower than the button pressed
then try going up the alphabet
if (row==0) {
key = (char)(int)button.Tag.ToString().ToCharArray(1,1)[0] - 1;
// work our way up the alphabet
while (row == 0 && (int)key >= (int)"A") {
row = this.dwPatientList.FindRow("left(sorted_name,1)='" + key
+ "'",row,dwPatientList.RowCount);
(int)key--;
}
}
Scroll to row