Operating system: W10 21H2
Hello together
I am pretty new to Powershell and especially in creating GUIs etc. I need help with the following topic:
I want to create a GUI with two datagrids that contain information that I have gathered from a json file. Some of this info is plain text and this I have already been able to store in a data table and also to view in the first datagrid (jeah! )
Now the tricky bit:
sometimes a field from the json contains only one option of many and the user should be able to reselect it via a combobox. But it's not like all fields have the same options. Every combobox has its own items.
So I need a datagrid that looks like this:
Code: Select all
header: Column 1 | Column 2
row 1: field 1 (fixed fieldname that comes from the json and is not adjustable) | combobox with some options and a selected one that is matching the info from the json
btw. I have created the first datagrid with the simple text fields like this:
Code: Select all
## - Create DataTable:
$table = New-Object System.Data.DataTable;
## - Defining DataTable object columns and rows properties:
# - Column1 = "Jira Field".
$column = New-Object System.Data.DataColumn;
$column.DataType = [System.Type]::GetType("System.String");
$column.ColumnName = "Jira Field";
$column.ReadOnly = $true;
$table.Columns.Add($column);
# - Column2 = "Value".
$column = New-Object System.Data.DataColumn;
$column.DataType = [System.Type]::GetType("System.String");
$column.ColumnName = "Value";
$column.ReadOnly = $false;
$table.Columns.Add($column);
## - Add Records to datatable dataset object:
$row = $table.NewRow();
$row["Jira Field"] = "Package Name";
$row["Value"] = $global:packageName;
$table.Rows.Add($row);
etc. ....
## - Save changes to the table:
$table.AcceptChanges();
## - Display custom data created:
$datagridviewJiraDataFreeText.DataSource = $table;