Private Sub dgvPassenger_CellmouseDoubleClick(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellMouseEventArgs) Handles dgvPassenger.CellMouseDoubleClick
DataGridView2Data.ImportRow(DataGridView1Data.Rows(e.RowIndex)) 'Import row from DataGridView1Data to DataGridView2Data.
' DataGridView2Data.DefaultView.Sort = "MonthID" 'Sort DataGridView2Data by MonthID Field.
dgvPassenger2.DataSource = DataGridView2Data 'Bind data to DataGridView2.
DataGridView1Data.Rows(e.RowIndex).Delete() 'Delete selected row from DataGridView1Data.
DataGridView1Data.AcceptChanges() 'Confirm change data.
dgvPassenger.DataSource = DataGridView1Data 'Bind data to DataGridView1.
End Sub
Private Sub dgvPassenger2_CellDoubleClick(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles dgvPassenger2.CellDoubleClick
DataGridView1Data.ImportRow(DataGridView2Data.Rows(e.RowIndex)) 'Import row from DataGridView2Data to DataGridView1Data.
' DataGridView1Data.DefaultView.Sort = "MonthID" 'Sort DataGridView1Data by MonthID FieldDataGridView1.DataSource = DataGridView1Data 'Bind data to DataGridView1.
DataGridView2Data.Rows(e.RowIndex).Delete() 'Delete selected row from DataGridView2Data.
DataGridView2Data.AcceptChanges() 'Confirm change data.
dgvPassenger2.DataSource = DataGridView2Data 'Bind data to DataGridView2.
End Sub
Dim dgvRow As New DataGridViewRow
Dim dgvCell As DataGridViewCell
Dim i, j As Integer
i = e.RowIndex
j = e.ColumnIndex
If j = 0 Then
dgvCell = New DataGridViewTextBoxCell()
dgvCell.Value = DataGridView1.Item(i, j).Value
dgvRow.Cells.Add(dgvCell)
DataGridView2.Rows.Add(dgvRow)
End If
Dim dgvRow As New DataGridViewRow
Dim dgvCell As DataGridViewCell
Dim i As Integer
i = e.RowIndex
dgvCell = New DataGridViewTextBoxCell()
dgvCell.Value = dgvPassenger.Item(i, 0).Value
dgvRow.Cells.Add(dgvCell)
dgvPassenger2.Rows.Add(dgvRow)