Selecting multiple values in datagridview?

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 5 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.
Locked
User avatar
stevens
Posts: 493
Last visit: Mon Sep 19, 2022 12:23 am
Has voted: 2 times

Selecting multiple values in datagridview?

Post by stevens »

Hi,

I have a gridview in which computernames are listed, together with their ad info (OU location etc).
The contextmenu "copy" is copying computername. However, when I select multiple lines, I'd like to have all the computernames.
Can you advise howto do this?

This is the code I have right now:

Code: Select all

$copyNameToolStripMenuItem1_Click={
	$Global:Computername = $datagridviewResults.CurrentRow.Cells[1].Value
	Add-ClipBoard $ComputerName
}
Thanks,
J
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: Selecting multiple values in datagridview?

Post by jvierra »

You would have to select all of that column from the grid using select-object.
This topic is 6 years and 5 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.
Locked