JohnDW
Well-known member
Dear forummembers,
I have a problem with filling a datagrid (DGV2) in my form.
The code does not do what I desire.
The problem in this code is the syntax of
If R.Scannummer Is DGV2.Rows (I). Cells (0). Value Then
It must be chanched in
If R.Scannummer = DGV2.Rows (I). Cells (0). Value Then
but this doesn't match with the option strict
the message I get than is :
"Option strict on disallows operands of the type object for operator ''='. Use the 'Is' operator to test for object identity. But the code 'does not function with IS. Is there a way to use the '=' operator?"
Any suggestions?
Grtz,
John
I have a problem with filling a datagrid (DGV2) in my form.
The code does not do what I desire.
VB.NET:
Dim I As Integer
ItemLoc Dim As Integer = -1
For I = 0 To DGV2.Rows.Count - 1
If R.Scannummer Is DGV2.Rows (I). Cells (0). Value Then
"Here I changed the code from:
'If R.Scannummer DGV2.Rows = (I). Cells (0). Value Then
'To: If R.Scannummer Is DGV2.Rows (I). Cells (0). Value Then
"Otherwise I get the message That
"Option strict on disallows operands of the type object for operator ''='. Use the 'Is' operator to test for object identity. But the code 'does not function with IS. Is there a way to use the '=' operator?
'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
The problem in this code is the syntax of
If R.Scannummer Is DGV2.Rows (I). Cells (0). Value Then
It must be chanched in
If R.Scannummer = DGV2.Rows (I). Cells (0). Value Then
but this doesn't match with the option strict
the message I get than is :
"Option strict on disallows operands of the type object for operator ''='. Use the 'Is' operator to test for object identity. But the code 'does not function with IS. Is there a way to use the '=' operator?"
Any suggestions?
Grtz,
John
Last edited: