Ask questions about creating Graphical User Interfaces (GUI) in PowerShell and using WinForms controls.
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.
This topic is 2 years and 11 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Hey all,
been working on adding in a data grid to my form in PowerShell Studio 2020. I have it added to my form, and am trying to update the datagrid every time a certain action is run. It is adding the Custom Objects like I want, but it is not updating them, but rather overwriting whats in there already with the new objects. Can you tell me what I need to change in my code to allow it to add the new objects and not overwrite whats already in there?
First you are mailing a number of common errors that most people new to programming make. Frist you are trying to state things in negative logical form which can be misleading and cause the logic to be difficult to understand or check. Second you are creati8ng multiple interim variables that are unnecessary and can also easily lead to a difficult to understand failure.
Here is the easiest way to state the issue without inconsistent logic and mucho variables.
Note that only one test is necessary and only one method of adding is required. Also creating the type for the DataSource should be done in the "Load" event and only done once.
The following article can help you to learn how to avoid many of these simple mistakes that most trying to learn programming make .
So when I run the code I submitted I get the results in the Data Grid that I was hoping but theyre overwritten. When I run the code you supplied, it updates the Data Grid but has none of the info (see attachments).
This topic is 2 years and 11 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.