J
Jay
I am working with this code for over 2 weeks and I can get this to work with
vb.net. this code works perfectly in vb 6.0. My problem is on how to convert
movefirst and find method from vb6 to vb.net.
Here's the code:
Private Function DeductOnhand(QtyNeeded As Integer, ByVal Order As Integer,
ByVal blnDeduct As Boolean, rs As Recordset) As Boolean
Dim Onhand As Boolean
Dim OrderTemp As Integer
Dim QtyNeededTemp As Double
Do Until DeductOnhand = True
OrderTemp = Order
QtyNeededTemp = QtyNeeded
rs.Find "Order = " & OrderTemp
Do Until Onhand = True 'Or OrderTemp = 1
If rs!Onhand >= QtyNeededTemp Then
If blnDeduct = False Then
DeductOnhand = True
Exit Function
Else
Onhand = True
End If
If QtyNeededTemp > 0 And QtyNeededTemp < 1 Then
QtyNeededTemp = 1
Else
QtyNeededTemp = CInt(QtyNeededTemp)
End If
Else
OrderTemp = OrderTemp - 1
If OrderTemp < 1 Then Exit Do
QtyNeededTemp = (QtyNeededTemp - rs!Onhand) / rs!Qty
rs.MoveFirst
rs.Find "Order = " & OrderTemp
End If
Loop
If Onhand = True Then
Do
rs!Onhand = rs!Onhand - QtyNeededTemp
OrderTemp = OrderTemp + 1
rs.MoveFirst
rs.Find "Order = " & OrderTemp
rs!Onhand = rs!Onhand + (QtyNeededTemp * rs!Qty)
rs.Update
Onhand = False
If OrderTemp = Order Then
DeductOnhand = True
Exit Do
Else
DeductOnhand = False
Exit Do
End If
Loop
Else
DeductOnhand = False
End If
Loop
End Function
In my vb.net code I tried using the select property of datatable but with no
luck.
Dim dt As DataTable = ds.Tables("ItemsDetails")
dt.Select("OrderNo = " & OrderTemp)
Anyone can please help me what is the equivalent of .movefirst and .find
property of vb6 to vb.net?
Thanks in advance
vb.net. this code works perfectly in vb 6.0. My problem is on how to convert
movefirst and find method from vb6 to vb.net.
Here's the code:
Private Function DeductOnhand(QtyNeeded As Integer, ByVal Order As Integer,
ByVal blnDeduct As Boolean, rs As Recordset) As Boolean
Dim Onhand As Boolean
Dim OrderTemp As Integer
Dim QtyNeededTemp As Double
Do Until DeductOnhand = True
OrderTemp = Order
QtyNeededTemp = QtyNeeded
rs.Find "Order = " & OrderTemp
Do Until Onhand = True 'Or OrderTemp = 1
If rs!Onhand >= QtyNeededTemp Then
If blnDeduct = False Then
DeductOnhand = True
Exit Function
Else
Onhand = True
End If
If QtyNeededTemp > 0 And QtyNeededTemp < 1 Then
QtyNeededTemp = 1
Else
QtyNeededTemp = CInt(QtyNeededTemp)
End If
Else
OrderTemp = OrderTemp - 1
If OrderTemp < 1 Then Exit Do
QtyNeededTemp = (QtyNeededTemp - rs!Onhand) / rs!Qty
rs.MoveFirst
rs.Find "Order = " & OrderTemp
End If
Loop
If Onhand = True Then
Do
rs!Onhand = rs!Onhand - QtyNeededTemp
OrderTemp = OrderTemp + 1
rs.MoveFirst
rs.Find "Order = " & OrderTemp
rs!Onhand = rs!Onhand + (QtyNeededTemp * rs!Qty)
rs.Update
Onhand = False
If OrderTemp = Order Then
DeductOnhand = True
Exit Do
Else
DeductOnhand = False
Exit Do
End If
Loop
Else
DeductOnhand = False
End If
Loop
End Function
In my vb.net code I tried using the select property of datatable but with no
luck.
Dim dt As DataTable = ds.Tables("ItemsDetails")
dt.Select("OrderNo = " & OrderTemp)
Anyone can please help me what is the equivalent of .movefirst and .find
property of vb6 to vb.net?
Thanks in advance