i am developing windows application project

i want that in a datagridview if there is data in the first row ,then i want that if i enter then that above row is copied as next row below the first row.so how i do code in enter of any cell in data gridview and generate next row

Try this

Private Sub DataGridView1_KeyUp(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles DataGridView1.KeyUp
        If Keys.Enter Then
            Dim _Dt As DataTable = Me.DataGridView1.DataSource
            If _Dt IsNot Nothing Then
                Dim _NewRow As System.Data.DataRow = _Dt.NewRow
                _Dt.Rows.Add(_NewRow)
                Me.DataGridView1.DataSource = _Dt

                _NewRow = Nothing
                _Dt.Dispose()
                _Dt = Nothing

            End If

        End If
    End Sub
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.