How would I go about selecting just the selected row in a datagrid view but only get the data from the second column?
Thanks
Matt
Datagridview select column
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: Datagridview select column
The columns collection is an array on the selected row. Just index into the column you want.
PowerShell Code
Double-click the code block to select all.$button1_Click={ $rowIndex=$datagridview1.CurrentCell.RowIndex [void][System.Windows.Forms.MessageBox]::Show($datagridview1.Rows[$rowIndex].Cells[1].Value,'Cell 2 value') } $datagridview1_CellContentClick=[System.Windows.Forms.DataGridViewCellEventHandler]{ $rowIndex=$datagridview1.CurrentCell.RowIndex [void][System.Windows.Forms.MessageBox]::Show($datagridview1.Rows[$rowIndex].Cells[1].Value,'Cell 2 value') }