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. .NET (Core and Framework)
  4. Tab Control Page Not Responding Fast Enough

Tab Control Page Not Responding Fast Enough

Scheduled Pinned Locked Moved .NET (Core and Framework)
helpperformancequestion
5 Posts 4 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.
  • U Offline
    U Offline
    User 2254591
    wrote on last edited by
    #1

    I have a CustomerInfo form which is an Mdi form to the main form. The CustomerInfo form a has TabControl with 4 TabPages on it. From the Main form CustomerInfo CI = new CustomerInfo(); In the form constructor event i have the following pseudeocode LoadGeneralTab() LoadOrderTab() LoadInvoiceTab() LoadPayHistoryTab() Each of these functions loads several Datagrids with information. Then from the main form CI.MdiParent = this; CI.Show(); The CustomerInfo form shows up as expected and all is good. But when I click on the orderTab or invoiceTab or the payHistoryTab it takes a long time to switch over to it. And the speed of the switch seems to be the amount of information contained in the datagrid views. What I don't understand is why this is happening as it seems to me that all the grids have been populated with information in the constructor so what is taking so long to switch over. I have done this before and not had the same problem. And help would be appreciated.

    Y G 2 Replies Last reply
    0
    • U User 2254591

      I have a CustomerInfo form which is an Mdi form to the main form. The CustomerInfo form a has TabControl with 4 TabPages on it. From the Main form CustomerInfo CI = new CustomerInfo(); In the form constructor event i have the following pseudeocode LoadGeneralTab() LoadOrderTab() LoadInvoiceTab() LoadPayHistoryTab() Each of these functions loads several Datagrids with information. Then from the main form CI.MdiParent = this; CI.Show(); The CustomerInfo form shows up as expected and all is good. But when I click on the orderTab or invoiceTab or the payHistoryTab it takes a long time to switch over to it. And the speed of the switch seems to be the amount of information contained in the datagrid views. What I don't understand is why this is happening as it seems to me that all the grids have been populated with information in the constructor so what is taking so long to switch over. I have done this before and not had the same problem. And help would be appreciated.

      Y Offline
      Y Offline
      Yusuf
      wrote on last edited by
      #2

      Member 2256533 wrote:

      And the speed of the switch seems to be the amount of information contained in the datagrid views

      Doesn't that answer your question. That implies you need to look closer to how the data is retrieved. May be you need to optimize your query. It is kinda hard to tell without looking at the code.

      Yusuf May I help you?

      U 1 Reply Last reply
      0
      • Y Yusuf

        Member 2256533 wrote:

        And the speed of the switch seems to be the amount of information contained in the datagrid views

        Doesn't that answer your question. That implies you need to look closer to how the data is retrieved. May be you need to optimize your query. It is kinda hard to tell without looking at the code.

        Yusuf May I help you?

        U Offline
        U Offline
        User 2254591
        wrote on last edited by
        #3

        No not really, It does take some time for the CustomerInfo form to show up, and I assume that is because it does take time to load all the information on each of the tabs. But once the CustomerInfo form is displayed all the information should be loaded. So switching between tab pages should be quick. But it seems that the tabs are being reloaded everytime I switch over to them.

        L 1 Reply Last reply
        0
        • U User 2254591

          No not really, It does take some time for the CustomerInfo form to show up, and I assume that is because it does take time to load all the information on each of the tabs. But once the CustomerInfo form is displayed all the information should be loaded. So switching between tab pages should be quick. But it seems that the tabs are being reloaded everytime I switch over to them.

          L Offline
          L Offline
          Luc Pattyn
          wrote on last edited by
          #4

          I guess the Controls (DGVs) that haven't been visible yet (those not on the first tab page) still haven't been rendered at all; so clicking on a tab will first cause the DGV to be actually created (including its Handle property), then the data being loaded into it. You could force this to happen sooner, IIRC reading Control.Handle suffices to make sure it really exists. Of course adding this to your Form.Load (or Shown) event will postpone its rendering of everything, including the first tab. A better way to handle the situation could be this, and I would recommend it anyway whenever the database accesses might take more than a second: - launch a thread to access the database, do not touch the Controls from that thread; - in the mean time, make sure all Controls really exist (Handle!); - when the database thread is done, make it signal the GUI thread and start showing the data. A BackgroundWorker would be good, having the DB stuff in its DoWork and the show-in-GUI stuff in its RunWorkercompleted handler. :)

          Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum

          Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.

          1 Reply Last reply
          0
          • U User 2254591

            I have a CustomerInfo form which is an Mdi form to the main form. The CustomerInfo form a has TabControl with 4 TabPages on it. From the Main form CustomerInfo CI = new CustomerInfo(); In the form constructor event i have the following pseudeocode LoadGeneralTab() LoadOrderTab() LoadInvoiceTab() LoadPayHistoryTab() Each of these functions loads several Datagrids with information. Then from the main form CI.MdiParent = this; CI.Show(); The CustomerInfo form shows up as expected and all is good. But when I click on the orderTab or invoiceTab or the payHistoryTab it takes a long time to switch over to it. And the speed of the switch seems to be the amount of information contained in the datagrid views. What I don't understand is why this is happening as it seems to me that all the grids have been populated with information in the constructor so what is taking so long to switch over. I have done this before and not had the same problem. And help would be appreciated.

            G Offline
            G Offline
            GenJerDan
            wrote on last edited by
            #5

            It's the grids doing it, not the database access as such. If you can "page" the results for the grids, only loading as many rows as will be displayed, it should speed up a bit.

            ..and water fell from the sky like rain.

            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