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. Managed C++/CLI
  4. How can I Refresh List Box in a loop adding item

How can I Refresh List Box in a loop adding item

Scheduled Pinned Locked Moved Managed C++/CLI
question
4 Posts 2 Posters 1 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.
  • P Offline
    P Offline
    Pankaj Jain
    wrote on last edited by
    #1

    I m trying to refresh ListBox when i m adding Items in a for loop. List box freshed after comliting loop. My code is here for(int i=1;i<=100;i+=1) //Loop { if(i%10==0) { SendDlgItemMessage(IDC_LIST3, LB_INSERTSTRING, (WPARAM) -1, (LPARAM) _T("HP Laser Jet 5000 Series PCL 6")); //Adding String in ListBox } } :doh: Repply Please

    Pankaj Jain

    P 1 Reply Last reply
    0
    • P Pankaj Jain

      I m trying to refresh ListBox when i m adding Items in a for loop. List box freshed after comliting loop. My code is here for(int i=1;i<=100;i+=1) //Loop { if(i%10==0) { SendDlgItemMessage(IDC_LIST3, LB_INSERTSTRING, (WPARAM) -1, (LPARAM) _T("HP Laser Jet 5000 Series PCL 6")); //Adding String in ListBox } } :doh: Repply Please

      Pankaj Jain

      P Offline
      P Offline
      prasad_som
      wrote on last edited by
      #2

      Why you want costly refreshing in this case? Any way it will not take much time to complete the loop. You can consider using WM_SETREDRAW for refreshing list box. You should ask such question in VC++[^] forum. As there is nothing specific to CLI in this question.

      Prasad Notifier using ATL | Operator new[],delete[][^]

      P 1 Reply Last reply
      0
      • P prasad_som

        Why you want costly refreshing in this case? Any way it will not take much time to complete the loop. You can consider using WM_SETREDRAW for refreshing list box. You should ask such question in VC++[^] forum. As there is nothing specific to CLI in this question.

        Prasad Notifier using ATL | Operator new[],delete[][^]

        P Offline
        P Offline
        Pankaj Jain
        wrote on last edited by
        #3

        Thanks Prasad! for ur reply, but there is no effect after modifying my code for(int i=1;i<=100;i+=1) //Loop { if(i%10==0) { SendDlgItemMessage(IDC_LIST3, LB_INSERTSTRING, (WPARAM) -1, (LPARAM) _T("HP Laser Jet 5000 Series PCL 6")); //Adding String in ListBox SendDlgItemMessage(IDC_LIST3, WM_SETREDRAW , 1, 1);//Code is added here } } Acually i want to add in listbox with the progresbar so I need to refresh listbox to show simulteneous progress, If u hv any other idea please share with me. I will take care about ur suggession in future. Thanks

        Pankaj Jain

        P 1 Reply Last reply
        0
        • P Pankaj Jain

          Thanks Prasad! for ur reply, but there is no effect after modifying my code for(int i=1;i<=100;i+=1) //Loop { if(i%10==0) { SendDlgItemMessage(IDC_LIST3, LB_INSERTSTRING, (WPARAM) -1, (LPARAM) _T("HP Laser Jet 5000 Series PCL 6")); //Adding String in ListBox SendDlgItemMessage(IDC_LIST3, WM_SETREDRAW , 1, 1);//Code is added here } } Acually i want to add in listbox with the progresbar so I need to refresh listbox to show simulteneous progress, If u hv any other idea please share with me. I will take care about ur suggession in future. Thanks

          Pankaj Jain

          P Offline
          P Offline
          prasad_som
          wrote on last edited by
          #4

          PK Jain wrote:

          Acually i want to add in listbox with the progresbar so I need to refresh listbox to show simulteneous progress

          Consider using thread for this. You can get lot of example related to this on CP.

          Prasad Notifier using ATL | Operator new[],delete[][^]

          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