Yes I know, I should click the column header, but nothing happens.
>If the DataTable is correctly bound to the table then it is sortable.
How can I check this?
ConvertDataset for GridView 'Invalid storage type: DBNull.'
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.
Re: ConvertDataset for GridView 'Invalid storage type: DBNull.'
Found out what the issue was, I do all kinds of filtering of the dataset, that makes that sorting isn't working anymore.
Load-DataGridView -DataGridView $datagridview1 -Item $($dataset | sort name)
does not work
Load-DataGridView -DataGridView $datagridview1 -Item $dataset
Works fine = sorting works.
However, I do need sorting, where should I sort then?
Load-DataGridView -DataGridView $datagridview1 -Item $($dataset | sort name)
does not work
Load-DataGridView -DataGridView $datagridview1 -Item $dataset
Works fine = sorting works.
However, I do need sorting, where should I sort then?
Re: ConvertDataset for GridView 'Invalid storage type: DBNull.'
Note: I also use filters
-$dataset = $dataset | Where-Object { $values -notcontains ...
Load-DataGridView -DataGridView $datagridview1 -Item $dataset
-$dataset = $dataset | Where-Object { $values -notcontains ...
Load-DataGridView -DataGridView $datagridview1 -Item $dataset
Re: ConvertDataset for GridView 'Invalid storage type: DBNull.'
Which is why I posted to use
$datagridview.DataSounrce = $dt.
You kept many issues hidden which makes it impossible to answer the question. A simple data table assigned as a DataSource is always sortable. I repeat - A single DataTable - not a data set - is always sortable.
Create a dataset and then converting it to something else using the "Load-DataGridView" is not what you asked about and will not work as expected. Why take a DataTable, call it a dataset and then try to convert it into a DataTable? Do you see what you are actually doing by trying to do it this way. It is just doing it three times for no reason.
Also the correct way to filter a DataTable object is the use the "RowFilter" Using Where-Object damages the table structure since it converted it into a set of custom objects.
A DataTable is a very special type of object which supports an extended array of capabilities. When add3ed to a form/control it completes the forms purpose which is to act as a Data management object. Notice how almost all controls have a "DataSource" property. This is because Forms and ADO were designed to work together.
Once you can get an understanding of how this works and how it is intended to be used coding forms will be much easier.
If you are interested, I can show you examples of very complex data bound forms that require very few lines of code to create.
$datagridview.DataSounrce = $dt.
You kept many issues hidden which makes it impossible to answer the question. A simple data table assigned as a DataSource is always sortable. I repeat - A single DataTable - not a data set - is always sortable.
Create a dataset and then converting it to something else using the "Load-DataGridView" is not what you asked about and will not work as expected. Why take a DataTable, call it a dataset and then try to convert it into a DataTable? Do you see what you are actually doing by trying to do it this way. It is just doing it three times for no reason.
Also the correct way to filter a DataTable object is the use the "RowFilter" Using Where-Object damages the table structure since it converted it into a set of custom objects.
A DataTable is a very special type of object which supports an extended array of capabilities. When add3ed to a form/control it completes the forms purpose which is to act as a Data management object. Notice how almost all controls have a "DataSource" property. This is because Forms and ADO were designed to work together.
Once you can get an understanding of how this works and how it is intended to be used coding forms will be much easier.
If you are interested, I can show you examples of very complex data bound forms that require very few lines of code to create.