Quantcast
Channel: SAPIEN Forums
Viewing all articles
Browse latest Browse all 512

PowerShell GUIs • Re: Datagridviewer get data from a selected row

$
0
0
To get the row and cell objects from the CellClick event, you would do something like the following:

Code:

$datagridview1_CellClick=[System.Windows.Forms.DataGridViewCellEventHandler]{
#Event Argument: $_ = [System.Windows.Forms.DataGridViewCellEventArgs]
$row = $datagridview1.Rows[$_.RowIndex] #Gets the row
$cell = $row.Cells[$_.ColumnIndex] #Gets the cell
$value = $cell.Value #Gets the value

}
You may find the following helpful:
viewtopic.php?t=14214
https://www.sapien.com/blog/2020/09/08/ ... w-control/

Statistics: Posted by brittneyr — Tue Jul 23, 2024 3:12 pm



Viewing all articles
Browse latest Browse all 512

Trending Articles