Unable to copy code here, so please see attached file.
Thanks
datagridview not populating
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.
- Alexander Riedel
- Posts: 8479
- Last visit: Thu Mar 28, 2024 9:29 am
- Been upvoted: 37 times
Re: datagridview not populating
[Topic moved by moderator]
Please do not put your entire post in a file. A short code sequence can be posted as text in this forum.
Longer code is preferably attached as a file, but still, the explanation of a problem or the question itself should be added to the post's text.
Thanks you for understanding.
Please do not put your entire post in a file. A short code sequence can be posted as text in this forum.
Longer code is preferably attached as a file, but still, the explanation of a problem or the question itself should be added to the post's text.
Thanks you for understanding.
Alexander Riedel
SAPIEN Technologies, Inc.
SAPIEN Technologies, Inc.
Re: datagridview not populating
Code: Select all
$button1_Click={
#TODO: Place custom script here$
$s = Get-Service
$t = ConvertTo-DataTable -InputObject $s
$datagridview1.DataSource = $t
}
Re: datagridview not populating
Thank you Alexander.Alexander Riedel wrote: ↑Wed Aug 05, 2020 8:52 am [Topic moved by moderator]
Please do not put your entire post in a file. A short code sequence can be posted as text in this forum.
Longer code is preferably attached as a file, but still, the explanation of a problem or the question itself should be added to the post's text.
Thanks you for understanding.
Re: datagridview not populating
Unfortunately, it still did not work after changing the code as described. Button2 behaviour remains the same, form freezes. Get-AZVM command runs fine when selected and run by right-clicking. Code attached here.jvierra wrote: ↑Wed Aug 05, 2020 12:38 pmCode: Select all
$button1_Click={ #TODO: Place custom script here$ $s = Get-Service $t = ConvertTo-DataTable -InputObject $s $datagridview1.DataSource = $t }
Thanks
- Attachments
-
- Code2.txt
- (358 Bytes) Downloaded 86 times
Re: datagridview not populating
No idea what you mean by right-clicking. A button takes a single click.
The Get-AzVM command can hang which has little to do with how to load the grid. Without more accurate information there is no way to advise you.
The Get-AzVM command can hang which has little to do with how to load the grid. Without more accurate information there is no way to advise you.
Re: datagridview not populating
Sorry, I meant right clicking in the script pane (not GUI) to test the command actually works on its own or not. Get-AZVM command works like get-process or get-service, and gives a list of VMs in tabular format.
Re: datagridview not populating
What script pane? Right click opens a context menu. You have to be clear and provide complete information. Create a simple form with a button and a grid and lace my code in the button to see how it works.
Re: datagridview not populating
My form is simple, just 2 buttons and a datagridview. Attached screenshots, hope this helps.
Thanks.
Thanks.