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 6 years and 6 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.
hi all,
i could use some help in adjusting a specific column in a DataGridView to buttons.
this script connects to RDS Farm and returns some details from the session hosts available.
i want column 7 to be buttons that eventually will trigger reboot for the corresponding session host.
i use a grid template for tests and this is what i have so far:
Is this a PSS project? The column in the DataTable has to be a Boolean and it must be in the table. Loading the grid will automatically create the correct column types. A Boolean should generate a checkbox.
You can also predefine the columns so they are named the same as the table columns. In the designer insert the column as a button column.
Hi jvierra,
thank you for your reply.
yes it is a powershell studio project (grid template). when i tried to configure the DataGrid in advance using the designer - all the column configuration was overwritten by the udpate-datagrid function or my own table updates...
The DataTable must be assigned using the DGV "DataSource" property and the column names - not just the headers - must match the table column names exactly. Table updates must be applied at the row level. The structure of the table cannot be changed after it is created and assigned.
thank you for pointing me to the right direction, my problem was putting my data in a DataTable and not directly in the DataGridView.
i was wondering if you could help me with another problem im having:
i added a button in the DVG and i want to pop up a confirmation dialog that user can approve or cancel the operation.
so i thought i could use this basic flow of events:
1. CellMouseClick
2. pop up a message box with OK:Cancel
3. if ok - endedit (not sure if its end or commit), if cancel - canceledit
One note of direction. When we build grids the usual command method is to use a “context” menu. That is why most controls have a property where you can assign the context menu and the control display it for you. This allows for many commands to be added to manage an item in a list, grid, view or other control. I usually alos assign one context item to the “doubleclick” of the control as the default action.
The reason you had trouble with the button is because you are trying to use it in a way that it was not designed to be used making finding how to get what you wanted much harder.
This topic is 6 years and 6 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.