PowerShell dataGridView - Copy only one Row into an other dataGridView

Posted by Marcel L. on Stack Overflow See other posts from Stack Overflow or by Marcel L.
Published on 2014-06-10T15:23:34Z Indexed on 2014/06/11 3:25 UTC
Read the original article Hit count: 637

I´ve got a very short question about the "dataGridView".

I´m developing with the Microsoft PowerShell and I want to copy one Row (from $dataGridView1) to the other ($dataGridView2).

With this Code I can only Copy the Value of the last focused Cell. I´ve tried to make this for a whole Row, but it´s only working with Cells.

Here is my Code:

**$btnListeAdd.Add_Click({

        $Row = $dataGridView1.Rows[ $dataGridView1.CurrentCell.RowIndex ]
        $dataGridView2.Rows.Add( $dataGridView1.CurrentCell.Value )
        $dataGridView1.Rows.Remove( $Row ) })
$tabListe.Controls.Add($btnListeAdd)**

Only the market Cell in $dataGridView1 (similar Column 1 or 2) will be cloned in Column1 in $dataGridView2 - in a extra Row, yey.

Thanks for helping me. Please show mercy. It´s my first day with the PowerShell.

Kind regards, Marcel L.

© Stack Overflow or respective owner

Related posts about powershell

Related posts about user-interface