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,
Datagridview - Tabpage freezing on TabControl
Forum rules
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
- angelofstealth
- Posts: 69
- Last visit: Wed Sep 28, 2022 10:04 am
- angelofstealth
- Posts: 69
- Last visit: Wed Sep 28, 2022 10:04 am
Re: Datagridview - Tabpage freezing on TabControl
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
$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
- angelofstealth
- Posts: 69
- Last visit: Wed Sep 28, 2022 10:04 am
Re: Datagridview - Tabpage freezing on TabControl
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?
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
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.
Once the grid is loaded it would not take time to display the tab.
- angelofstealth
- Posts: 69
- Last visit: Wed Sep 28, 2022 10:04 am
Re: Datagridview - Tabpage freezing on TabControl
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
Attaching psf
- Attachments
-
- MainForm.psf
- (211.25 KiB) Downloaded 130 times
Re: Datagridview - Tabpage freezing on TabControl
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.
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.
- angelofstealth
- Posts: 69
- Last visit: Wed Sep 28, 2022 10:04 am
Re: Datagridview - Tabpage freezing on TabControl
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.
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.
- angelofstealth
- Posts: 69
- Last visit: Wed Sep 28, 2022 10:04 am
Re: Datagridview - Tabpage freezing on TabControl
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
viewtopic.php?t=6470