Hello,
I am using vb.net and access database.
I have FrmInvoice which has a unbound datagridview1.
It has columns like ProductID, Product Name, Qty, Rate, Amount.
I have a second form named as FrmAddItems for transferring values to FrmInvoice's datagridview through Textboxes
ie. TxtProductID, TxtProductName, TxtQty, TxtRate, TxtAmount.
The datagridview1's property - modifiers is set to public.
I am adding rows from FrmAddItems. The code is -
FrmInvoice.DataGridView1.Rows.Add(TxtProductID, TxtProductName, TxtQty, TxtRate, TxtAmount).
This code works fine.
FrmAddItems has Add, Update, delete button in it.
I am getting values in FrmAddItems's Text boxes from DataGridView1 cellcontentclick event, its code is
This code also works fine.
I want to update selected row from this FrmAddItems when update button is pressed.
can anyone help on this ?
I am using vb.net and access database.
I have FrmInvoice which has a unbound datagridview1.
It has columns like ProductID, Product Name, Qty, Rate, Amount.
I have a second form named as FrmAddItems for transferring values to FrmInvoice's datagridview through Textboxes
ie. TxtProductID, TxtProductName, TxtQty, TxtRate, TxtAmount.
The datagridview1's property - modifiers is set to public.
I am adding rows from FrmAddItems. The code is -
FrmInvoice.DataGridView1.Rows.Add(TxtProductID, TxtProductName, TxtQty, TxtRate, TxtAmount).
This code works fine.
FrmAddItems has Add, Update, delete button in it.
I am getting values in FrmAddItems's Text boxes from DataGridView1 cellcontentclick event, its code is
VB.NET:
Private Sub DataGridView1_CellContentClick(sender As Object, e As DataGridViewCellEventArgs) Handles DataGridView1.CellContentClick
Dim colName As String = DataGridView1.Columns(e.ColumnIndex).Name
With FrmAddItems
FrmAddItems.TxtProductID = DataGridView1.CurrentRow.Cells(0).Value
FrmAddItems.TxtProductName = DataGridView1.CurrentRow.Cells(1).Value
FrmAddItems.TxtQty.Text = DataGridView1.CurrentRow.Cells(2).Value
FrmAddItems.TxtRate.Text = DataGridView1.CurrentRow.Cells(3).Value
FrmAddItems.TxtAmount.Text = DataGridView1.CurrentRow.Cells(4).Value
FrmAddItems.Show()
FrmAddItems.BtnAdd.Visible = False
End With
End Sub
I want to update selected row from this FrmAddItems when update button is pressed.
can anyone help on this ?
Last edited by a moderator: