JohnDW
Well-known member
I have a subform in Access where I input records.
Next to each record there is a button that the data in the record can
to change.
In vb.net windows form I have a datagrid that I can fill
of records. It is possible to, as in access, each time a
record is loaded in the datagridview, in addition to the data grid also displays a button that, when pressed by the user, the data in a field of the record changes?
Grateful,
John
Next to each record there is a button that the data in the record can
to change.
In vb.net windows form I have a datagrid that I can fill
of records. It is possible to, as in access, each time a
record is loaded in the datagridview, in addition to the data grid also displays a button that, when pressed by the user, the data in a field of the record changes?
VB.NET:
Dim I As Integer
ItemLoc Dim As Integer = -1
For I = 0 To DGV2.Rows.Count - 1
If R.Scannummer DGV2.Rows = (I). Cells (0). Value Then
'Item found
ItemLoc = I
Exit For
end If
Next
'If item is not found, add it
If ItemLoc = -1 Then
DGV2.Rows.Add (R.Scannummer, R.ProductId, R.Productomschrijving, R.CategorieId, R.Productnaam, R.KleurId, R.MaatId, R.Verkoopprijs, 1, R.Verkoopprijs)
else
'If item is already there increasefontsize its count
Item Dim Count As Long = CLng (DGV2.Rows (ItemLoc). Cells (8). Value)
Item Count = 1
Dim newPrice As Decimal = CDec (R.Verkoopprijs * Item Count)
DGV2.Rows (ItemLoc). Cells (8). Value = Item Count
DGV2.Rows (ItemLoc). Cells (9). Value = newPrice
end If
Grateful,
John