A
amiga500
Hello,
I made this function so that it can return 1 or 2 where 1 either equal
PieIX or Mendonta or 2 equal either PieIX or Mendonta. Let me go
further in details...in the program it shows all Inventory information
in the datagrid and one column in the datagrid there is a combo box
where I can choose either PieIX or Mendonta and depending on which of
those I select first would determine wether 1 is pieIx and 2 Mendonta
or 1 is Mendonta or 2 is PieIX. For example as below:
ItemNumber AlbumTitle Fulfillment
BO 2222 Best of Poco Lives Mendonta
BO 3333 BoulderDash PieIX
The function below should return 1 for mendonta and 2 for pieIX but if
I decided to do this instead:
ItemNumber AlbumTitle Fulfillment
BO 2222 Best of Poco Lives PieIX
BO 3333 BoulderDash Mendonta
Now this function below should return 1 for PieIX and 2 for Mendonta,
I have this problem what if the function causes a malfunction and then
returns both 1 and 2 PieIX or 1,2 Mendonta, etc, so I just wanted an
outside eye to tell me if there is any bug in my coding? Thanks in
advance.
Below is my code:
Private Function getFulfillment(ByVal strFulfillment As String) As
Integer
Dim intCounter As Integer = Nothing
Dim blAgain As Boolean = False
tryAgain:
If strFulfillment = "Lasalle" Then Exit Function
If strFulfillment = "" Then Exit Function
If blAgain = True Then
blAgain = False
If objTypes(0).strName = objTypes(1).strName Then Return 1
If objTypes(0).strName = "" And objTypes(1).strName <> ""
Then Return 2
If objTypes(0).strName <> "" And objTypes(1).strName = ""
Then Return 1
End If
If objTypes(bytNextFulfillment).strName = "" Then
If objTypes(0).strName = "Pie-IX" And objTypes(1).strName
= "Pie-IX" Then GoTo COMPLETE
If objTypes(1).strName = "Mendota" And objTypes(1).strName
= "Mendota" Then GoTo COMPLETE
intNewValue = intNewValue + 1
If intNewValue > 2 Then intNewValue = 2
If bytNextFulfillment > 1 Then bytNextFulfillment = 1
If objTypes(bytNextFulfillment).strName = "" Then
objTypes(bytNextFulfillment).bytType = intNewValue
objTypes(bytNextFulfillment).strName = strFulfillment
bytNextFulfillment = bytNextFulfillment + 1
End If
End If
If objTypes(0).strName = "Pie-IX" And objTypes(1).strName =
"Pie-IX" Then objTypes(1).strName = "" : bytNextFulfillment = 0 :
blAgain = True : GoTo tryAgain
If objTypes(0).strName = "Mendota" And objTypes(1).strName =
"Mendota" Then objTypes(1).strName = "" : bytNextFulfillment = 0 :
blAgain = True : GoTo tryAgain
COMPLETE:
If bytNextFulfillment > 1 Then bytNextFulfillment = 1
For intCounter = 0 To 1
If objTypes(intCounter).strName = strFulfillment Then
Return objTypes(intCounter).bytType
Next intCounter
End Function
I made this function so that it can return 1 or 2 where 1 either equal
PieIX or Mendonta or 2 equal either PieIX or Mendonta. Let me go
further in details...in the program it shows all Inventory information
in the datagrid and one column in the datagrid there is a combo box
where I can choose either PieIX or Mendonta and depending on which of
those I select first would determine wether 1 is pieIx and 2 Mendonta
or 1 is Mendonta or 2 is PieIX. For example as below:
ItemNumber AlbumTitle Fulfillment
BO 2222 Best of Poco Lives Mendonta
BO 3333 BoulderDash PieIX
The function below should return 1 for mendonta and 2 for pieIX but if
I decided to do this instead:
ItemNumber AlbumTitle Fulfillment
BO 2222 Best of Poco Lives PieIX
BO 3333 BoulderDash Mendonta
Now this function below should return 1 for PieIX and 2 for Mendonta,
I have this problem what if the function causes a malfunction and then
returns both 1 and 2 PieIX or 1,2 Mendonta, etc, so I just wanted an
outside eye to tell me if there is any bug in my coding? Thanks in
advance.
Below is my code:
Private Function getFulfillment(ByVal strFulfillment As String) As
Integer
Dim intCounter As Integer = Nothing
Dim blAgain As Boolean = False
tryAgain:
If strFulfillment = "Lasalle" Then Exit Function
If strFulfillment = "" Then Exit Function
If blAgain = True Then
blAgain = False
If objTypes(0).strName = objTypes(1).strName Then Return 1
If objTypes(0).strName = "" And objTypes(1).strName <> ""
Then Return 2
If objTypes(0).strName <> "" And objTypes(1).strName = ""
Then Return 1
End If
If objTypes(bytNextFulfillment).strName = "" Then
If objTypes(0).strName = "Pie-IX" And objTypes(1).strName
= "Pie-IX" Then GoTo COMPLETE
If objTypes(1).strName = "Mendota" And objTypes(1).strName
= "Mendota" Then GoTo COMPLETE
intNewValue = intNewValue + 1
If intNewValue > 2 Then intNewValue = 2
If bytNextFulfillment > 1 Then bytNextFulfillment = 1
If objTypes(bytNextFulfillment).strName = "" Then
objTypes(bytNextFulfillment).bytType = intNewValue
objTypes(bytNextFulfillment).strName = strFulfillment
bytNextFulfillment = bytNextFulfillment + 1
End If
End If
If objTypes(0).strName = "Pie-IX" And objTypes(1).strName =
"Pie-IX" Then objTypes(1).strName = "" : bytNextFulfillment = 0 :
blAgain = True : GoTo tryAgain
If objTypes(0).strName = "Mendota" And objTypes(1).strName =
"Mendota" Then objTypes(1).strName = "" : bytNextFulfillment = 0 :
blAgain = True : GoTo tryAgain
COMPLETE:
If bytNextFulfillment > 1 Then bytNextFulfillment = 1
For intCounter = 0 To 1
If objTypes(intCounter).strName = strFulfillment Then
Return objTypes(intCounter).bytType
Next intCounter
End Function