Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Formating the output in the ListBox

Formating the output in the ListBox

Scheduled Pinned Locked Moved C / C++ / MFC
help
6 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    VinayCool
    wrote on last edited by
    #1

    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.

    N L 2 Replies Last reply
    0
    • V VinayCool

      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.

      N Offline
      N Offline
      Nibu babu thomas
      wrote on last edited by
      #2

      I guess your ListBox items are getting sorted. Disable sorting and check.


      Nibu thomas Software Developer Programming Tips[^]

      V 1 Reply Last reply
      0
      • N Nibu babu thomas

        I guess your ListBox items are getting sorted. Disable sorting and check.


        Nibu thomas Software Developer Programming Tips[^]

        V Offline
        V Offline
        VinayCool
        wrote on last edited by
        #3

        Hi Nibu thomas, Thanks a lot ,yes i had forgot to disable the sort , Now its working fine....:)

        N 1 Reply Last reply
        0
        • V VinayCool

          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.

          L Offline
          L Offline
          Laxman Auti
          wrote on last edited by
          #4

          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:

          V 1 Reply Last reply
          0
          • V VinayCool

            Hi Nibu thomas, Thanks a lot ,yes i had forgot to disable the sort , Now its working fine....:)

            N Offline
            N Offline
            Nibu babu thomas
            wrote on last edited by
            #5

            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[^]

            1 Reply Last reply
            0
            • L Laxman Auti

              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:

              V Offline
              V Offline
              VinayCool
              wrote on last edited by
              #6

              Hi Laxman, Thank you very much for formating the output,code is working great.... I had used indentation,after copy paste of code it was altered.... Thanks once again .....:)

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups