• Visit Rebornbuddy
  • Visit Panda Profiles
  • Visit LLamamMagic
  • Settings Form DataGridView Causing Hangs

    Discussion in 'Community Developer Forum' started by Sinbeard, Feb 3, 2021.

    1. Sinbeard

      Sinbeard New Member

      Joined:
      Oct 14, 2019
      Messages:
      14
      Likes Received:
      1
      Trophy Points:
      1
      I've been working on a sales stats plugin and I'm using a DataGridView (DGV) to display all the sales in the json db it creates. I think I've gotten it to a mostly stable state (maybe) but the DGV is incredibly slow, especially as the list grows. The json list is bound to the DGV using a BindingList.

      One thing in particular - if I leave the window open (unverified if it happens elsewhere) and the list grows long enough to require a scrollbar it will cause the application to hang indefinitely.

      upload_2021-2-3_12-10-23.png

      Is there a more efficient or better performance way to display data like this? Or am I stuck with a DGV? And if I am stuck with a DGV, what can I do to make it less stupid? It's very annoying.

      I can provide a link to the code on github as well if desired. Some of the text is obfuscated for a little bit of security.
       
    2. Sinbeard

      Sinbeard New Member

      Joined:
      Oct 14, 2019
      Messages:
      14
      Likes Received:
      1
      Trophy Points:
      1
      On a side note, is it possible to obtain these messages while the bot is off? I have a botbase that doesn't do anything that'll capture messages when i'm not using anything, but it'd be convenient if at all possible...
       
    3. mastahg

      mastahg Administrator Staff Member

      Joined:
      Feb 27, 2011
      Messages:
      5,332
      Likes Received:
      378
      Trophy Points:
      83
    4. Sinbeard

      Sinbeard New Member

      Joined:
      Oct 14, 2019
      Messages:
      14
      Likes Received:
      1
      Trophy Points:
      1
      In the intervening time from when I posted this I did actually find out about the double buffer thing which is pretty cool. I'll add in that autosize thing as well. I learned as well that apparently updating a BindingList outside the UI thread is a problem. Not only is it wonky, but it seems that scrollbars cause the problem I had above. I changed my code up to use List<string> instead and set a timer to update when the window is open. So far it doesn't explode but it also doesn't update in 'real' time. I probably need to clear and rebind or something.

      But anyway it runs a lot smoother and faster now. Code is here if you want to take a look: https://github.com/m3chanical/SalesTracker

      Thanks for the tip on the GamelogManager.Pulse(), I'll see if I work that in sensibly.
      Thank you!
       

    Share This Page