Formating the output in the ListBox
-
Hi, I have a used the list box to display the output of the function, Function generates output like Required Output in the list box. Filename1 213,456,645,654,647,990 Filename2 534,534,534,543,534,534 Filename3 434,545,655,765,788,1422 Output generated, 213 456 645 654 647 990 534 534 534 543 534 534 434 545 655 765 788 1422 Filename1 Filename2 Filename3 --------------------------------- Function :- void CSearchDlg :: disp () { int i = 0; while (strlen (shWord[i].file_name) > 1) { m_SOUT.AddString(shWord[i].file_name); int k = 0; while (shWord[i].w_offset[k] != -1) { TCHAR buffer[50]; int f=shWord[i].w_offset[k]; _itoa(f,buffer,10); m_SOUT.AddString(buffer); k++; } i++; } } ------------------------------------------------- Can anyone help with this function and to generate proper output in the list box.
-
Hi, I have a used the list box to display the output of the function, Function generates output like Required Output in the list box. Filename1 213,456,645,654,647,990 Filename2 534,534,534,543,534,534 Filename3 434,545,655,765,788,1422 Output generated, 213 456 645 654 647 990 534 534 534 543 534 534 434 545 655 765 788 1422 Filename1 Filename2 Filename3 --------------------------------- Function :- void CSearchDlg :: disp () { int i = 0; while (strlen (shWord[i].file_name) > 1) { m_SOUT.AddString(shWord[i].file_name); int k = 0; while (shWord[i].w_offset[k] != -1) { TCHAR buffer[50]; int f=shWord[i].w_offset[k]; _itoa(f,buffer,10); m_SOUT.AddString(buffer); k++; } i++; } } ------------------------------------------------- Can anyone help with this function and to generate proper output in the list box.
I guess your ListBox items are getting sorted. Disable sorting and check.
Nibu thomas Software Developer Programming Tips[^]
-
I guess your ListBox items are getting sorted. Disable sorting and check.
Nibu thomas Software Developer Programming Tips[^]
-
Hi, I have a used the list box to display the output of the function, Function generates output like Required Output in the list box. Filename1 213,456,645,654,647,990 Filename2 534,534,534,543,534,534 Filename3 434,545,655,765,788,1422 Output generated, 213 456 645 654 647 990 534 534 534 543 534 534 434 545 655 765 788 1422 Filename1 Filename2 Filename3 --------------------------------- Function :- void CSearchDlg :: disp () { int i = 0; while (strlen (shWord[i].file_name) > 1) { m_SOUT.AddString(shWord[i].file_name); int k = 0; while (shWord[i].w_offset[k] != -1) { TCHAR buffer[50]; int f=shWord[i].w_offset[k]; _itoa(f,buffer,10); m_SOUT.AddString(buffer); k++; } i++; } } ------------------------------------------------- Can anyone help with this function and to generate proper output in the list box.
vinaycool wrote:
Can anyone help with this function and to generate proper output in the list box.
Try the following code
void CSearchDlg :: disp ()
{
int i = 0;
while (strlen (shWord[i].file_name) > 1)
{
m_SOUT.AddString(shWord[i].file_name);
int k = 0;
TCHAR buff[100];
strcpy(buff,"\0");
while (shWord[i].w_offset[k] != -1)
{
TCHAR buffer[50];
int f=shWord[i].w_offset[k];
_itoa(f,buffer,10);
strcat(buff,buffer);
strcat(buff,",");
k++;
}
buff[strlen(buff)-1]='\0';
m_SOUT.AddString(buff);
i++;
}
}As well use proper indentation, so that others can understand your code. :) I have not tested the code, hope this works Knock out 't' from can't, You can if you think you can :cool:
-
Hi Nibu thomas, Thanks a lot ,yes i had forgot to disable the sort , Now its working fine....:)
vinaycool wrote:
Thanks a lot ,yes i had forgot to disable the sort , Now its working fine....
You're welcome. :)
Nibu thomas Software Developer Programming Tips[^]
-
vinaycool wrote:
Can anyone help with this function and to generate proper output in the list box.
Try the following code
void CSearchDlg :: disp ()
{
int i = 0;
while (strlen (shWord[i].file_name) > 1)
{
m_SOUT.AddString(shWord[i].file_name);
int k = 0;
TCHAR buff[100];
strcpy(buff,"\0");
while (shWord[i].w_offset[k] != -1)
{
TCHAR buffer[50];
int f=shWord[i].w_offset[k];
_itoa(f,buffer,10);
strcat(buff,buffer);
strcat(buff,",");
k++;
}
buff[strlen(buff)-1]='\0';
m_SOUT.AddString(buff);
i++;
}
}As well use proper indentation, so that others can understand your code. :) I have not tested the code, hope this works Knock out 't' from can't, You can if you think you can :cool: