datagridview import-csv

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.
Locked
User avatar
derhoeppi
Posts: 34
Joined: Sun Apr 06, 2014 11:10 pm

datagridview import-csv

Post by derhoeppi » Tue Jun 28, 2016 5:11 am

Hi,

i Import csv data to a datagridview. This data should be variables so i want to set the first column to readonly. Is that possible?

jvierra
Posts: 13915
Joined: Tue May 22, 2007 9:57 am
Contact:

Re: datagridview import-csv

Post by jvierra » Tue Jun 28, 2016 6:51 am

Not sure what you mean by "This data should be variables ". What data and what variables.

Yes you can set the grid to be read only.

$datagridview1.Columns[0].ReadOnly=$true

User avatar
derhoeppi
Posts: 34
Joined: Sun Apr 06, 2014 11:10 pm

Re: datagridview import-csv

Post by derhoeppi » Tue Jun 28, 2016 11:49 pm

"This data should be variables ".
Hi,
i want to create a gui to modifie my the values of my variables and arrays. Because they are used in my scripts i want to deny any changes of the name from my variables and arrays.

I tried your suggestion but ist not read only. Because i'm new in PowerShell Studio - i think that i insert this one at the wrong position. I attached the psf and my csv file, so you are able to look in my Little script / gui.
Attachments
Variables.psf
(17.39 KiB) Downloaded 61 times
Variables.csv
(99 Bytes) Downloaded 49 times

jvierra
Posts: 13915
Joined: Tue May 22, 2007 9:57 am
Contact:

Re: datagridview import-csv

Post by jvierra » Wed Jun 29, 2016 6:14 am

You didn't add the code I posted. It works as I noted.

First try to understand what the code is doing. Start by reading the blog articles on the DGV control and run the script in the debugger until you see how it works.

Locked