Greeting guys,
What I have is a inventory database setup as a datagrid bound to a datatable. Everything is working great, but what I would like to do is if at any point in time we let say, order 3 pieces of hardware on one purchase I would like to add one row (with a form for new hardware) then after that row is done and the datagrid has added it, I would like to right click on that selected row and copy it to the same datagrid. I can get it to copy but the serial of the new hardware is unique so I need to change that before it is copied.
The problem is I am not sure how to change the cell that holds the serial before it is added. Of course this lineCode:Private Sub CntxtMnuCopy_Click(sender As Object, e As EventArgs) Handles CntxtMnuCopy.Click Dim SelectedHardware As String Dim NewValue As Object SelectedHardware = DataGridView6.CurrentRow.Cells(1).Value DataGridView6.EndEdit() Dim TargetTable = DirectCast(SwitchesBindingSource.DataSource, DataTable) Dim rows = DataGridView6.SelectedRows NewValue = InputBox("Enter New Serial", "New Serial") For Each row As DataGridViewRow In rows If row.Index = 1 Then DataGridView6.Cells(0).Value = NewValue.ToString End If TargetTable.ImportRow(CType(SwitchesBindingSource.Item(row.Index), DataRowView).Row) Next End Sub
doesn't work. Am I on the right path with this or is there an easier way? It would also need to be saved to the database as well.Code:DataGridView6.Cells(0)




Reply With Quote