I have set up a Sales order form with the following Form Event to get weights into the Quote and Sales Order forms.
Private Sub OrderDtl_AfterFieldChange(ByVal sender As object, ByVal args As DataColumnChangeEventArgs) Handles OrderDtl_Column.ColumnChanged
'// ** Argument Properties and Uses **
'// args.Row("[FieldName]")
'// args.Column, args.ProposedValue, args.Row
'
'Add Event Handler Code
'
Dim edvOrderDtl As EpiDataView = CType(oTrans.EpiDataViews("OrderDtl"), EpiDataView)
Dim edvPart As EpiDataView = CType(oTrans.EpiDataViews("Weight"), EpiDataView)
Select Case args.Column.ColumnName
Case "SellingQuantity"
EdvOrderDtl.dataview(edvOrderDtl.Row)("Number01") = EdvPart.dataview(edvPart.Row)("NetWeight") * EdvOrderDtl.dataview(edvOrderDtl.Row)("OrderQty")
otrans.update()
otrans.refresh()
Case Else
End Select
End Sub
This works very well. My problem is that if the salesmen input a part number that is not in the system it kicks out a stack error when you try to input a quantity for the item. If you "OK" the error and try a couple of times you can get the number to stay on the form. The error detail says "Index -1 is either negative or above rows count".
Is there a line of code that can be put into this setup to make the system ignore the fact the part number used is not in the system. If they use the form without the weight setup on it it will allow them to use a part number not in the system with no problem.
Thank You
Gene Mack
Private Sub OrderDtl_AfterFieldChange(ByVal sender As object, ByVal args As DataColumnChangeEventArgs) Handles OrderDtl_Column.ColumnChanged
'// ** Argument Properties and Uses **
'// args.Row("[FieldName]")
'// args.Column, args.ProposedValue, args.Row
'
'Add Event Handler Code
'
Dim edvOrderDtl As EpiDataView = CType(oTrans.EpiDataViews("OrderDtl"), EpiDataView)
Dim edvPart As EpiDataView = CType(oTrans.EpiDataViews("Weight"), EpiDataView)
Select Case args.Column.ColumnName
Case "SellingQuantity"
EdvOrderDtl.dataview(edvOrderDtl.Row)("Number01") = EdvPart.dataview(edvPart.Row)("NetWeight") * EdvOrderDtl.dataview(edvOrderDtl.Row)("OrderQty")
otrans.update()
otrans.refresh()
Case Else
End Select
End Sub
This works very well. My problem is that if the salesmen input a part number that is not in the system it kicks out a stack error when you try to input a quantity for the item. If you "OK" the error and try a couple of times you can get the number to stay on the form. The error detail says "Index -1 is either negative or above rows count".
Is there a line of code that can be put into this setup to make the system ignore the fact the part number used is not in the system. If they use the form without the weight setup on it it will allow them to use a part number not in the system with no problem.
Thank You
Gene Mack