Page 1 of 2

Datagridview - Tabpage freezing on TabControl

Posted: Tue May 30, 2017 12:51 pm
by angelofstealth
Using Jobtracker to pull data from remote computers
- Working fine, not freezing GUI
- Once all results are back i populate datagridviews

If i click on a tab for the first time that has a datagridview with lots of data it freezes the form, after a few seconds restores and the tab revealed with the data. I have tried refreshing the tabs/tabcontrol after i populated the datagridviews but it still freezes on tabs with datagridviews with lots of data. Is there a way around that, or is that the limitation of the gui/datagridview on a tabcontrol/tabpage? Thanks,

Re: Datagridview - Tabpage freezing on TabControl

Posted: Tue May 30, 2017 12:53 pm
by jvierra
It all depends on how you are loading the grid.

Re: Datagridview - Tabpage freezing on TabControl

Posted: Tue May 30, 2017 1:05 pm
by angelofstealth
Example:
$ComputerWinUpdates = $global:AllWindowsUpdates | Select-Object 'Computer Name', 'Description', 'Fix Comments', 'Hot Fix ID', 'Installed By', 'Installed On', `
'Installed Date', 'KB Article', 'Name', 'Service Pack In Effect', 'Status', 'Index' | Sort 'Computer Name', 'Index'
Update-DataGridView $datagridviewWinUp $ComputerWinUpdates

Re: Datagridview - Tabpage freezing on TabControl

Posted: Tue May 30, 2017 1:34 pm
by jvierra
That doesn't tell us anything. Where are you executing this code?

Re: Datagridview - Tabpage freezing on TabControl

Posted: Tue May 30, 2017 1:46 pm
by angelofstealth
This is my routine...

1) Computer Objects read through a loop, within the loop Add-Jobtracker is kicked off (job-named after Computer Object)
2) Within the $CompletedScript, results are returned from the $jobscript and passed into global array variables
3) A global counter is increased every time within $CompletedScript. Once the global counter match the global counter of total Computer Objects from step 1, datagridviews are updated. As I only want to update the datagridviews once all the trackers data is returned.

I do refresh the form and tabcontrol at the end of the $CompletedScript. Do I need to refresh each tabpage and datagridview after the load?

Re: Datagridview - Tabpage freezing on TabControl

Posted: Tue May 30, 2017 2:03 pm
by jvierra
That does not tell us how the tab is being loaded. Without a code example it is not really possible to know where you are failing. I recommend using the debugger to step through the tab activation.

Once the grid is loaded it would not take time to display the tab.

Re: Datagridview - Tabpage freezing on TabControl

Posted: Tue May 30, 2017 5:42 pm
by angelofstealth
I can't use the debugger, as I am testing in a different domain/environment from where i have the sapien software installed.

Attaching psf

Re: Datagridview - Tabpage freezing on TabControl

Posted: Tue May 30, 2017 5:54 pm
by jvierra
Best I can tell you is that you are reloading everything every time you change your tabs.

I cannot spend the time trying to decode 2000+ lines of code. It also seems that you have way too much code for what you are trying to do. You should only have about 300 lines if you use events and jobs correctly.

Re: Datagridview - Tabpage freezing on TabControl

Posted: Tue May 30, 2017 6:51 pm
by angelofstealth
In regards to the issue i am asking about is in the control $buttonGUIQuery_Click={} , there is no duplication of code being used. The Scriptblock in the $jobscript is coded for when data can be or not be pulled back by a remote session and that the tables/columns match.

I don't see where you pointing out where i reloading everything when changing tabs, when i have no click event triggers for the tabcontrol. The tabcontrol datagridviews are wipe and populated anytime the $buttonGUIQuery_Click={} is ran. There is 2000 lines of code due to different procedures being completed, this is one task being completed plus logging.


$buttonADExecute - Is what goes out to Active Directory or whatever the user selected from the dropdown and pulls in the objects into the datagridview1 on Active Directory Computer Objects
$buttonGUIQuery - Takes what the user selected from the Active Directory Computer objects datagridview and passes the computer name to each tracker to pass a scriptblock to pull local data.

Re: Datagridview - Tabpage freezing on TabControl

Posted: Tue May 30, 2017 7:10 pm
by angelofstealth
I did find this old article that seems to be what i am going through with a datagridview having many rows/tables. I only have this freezing on the tabs with lots of data/tables, ie Windows Updates will have lots of data vs the CPU tab.

viewtopic.php?t=6470