Page 1 of 1

Datagridview

Posted: Sun Jan 12, 2020 9:21 am
by mattys
Ive created a datagridview
Im able to import a csv, makes changes, export just fine.
  1. $rows = Import-csv -Path C:\Users\Gino\Documents\receivingTEST.csv
  2.     $table = ConvertTo-DataTable -InputObject $rows
  3.     Update-DataGridView -DataGridView $datagridview1 -Item $table
Im trying to create preset columns for more functionality, but when I do, the CSV data that is imported is all shifted to the right of Premade columns.
Image
Any help is appreciated.

Re: Datagridview

Posted: Sun Jan 12, 2020 9:37 am
by jvierra
You have to add the columns after you import or pre-create all columns matching the names in the CSV,

Re: Datagridview

Posted: Sun Jan 12, 2020 10:01 am
by mattys
Thanks for a fast reply.
Ive tried preseting through the designer with a failed attempt
Image

What am I missing?

Re: Datagridview

Posted: Sun Jan 12, 2020 10:09 am
by jvierra
You have to make the data name the same as the column name. Just changing the display name won't bind the column to the column.

Re: Datagridview

Posted: Sun Jan 12, 2020 10:14 am
by mattys
O wow. I completely missed the 'data property name'

Thank you so much jvierra!

Re: Datagridview

Posted: Sun Jan 12, 2020 10:24 am
by jvierra
Yup. I did the same thig the first time I used the DGV.

It is always the best approach to review the online docs for any control you plane to use. It will save you a lot of wasted time.