Code:
Dim type As String
Dim Number As String
Dim Math As Decimal
If String.IsNullOrEmpty(txtType.Text) Then
MessageBox.Show("Error! Please insert a W or R.", _
"Marine Packing", MessageBoxButtons.OK, _
MessageBoxIcon.Information, MessageBoxDefaultButton.Button1)
Else
type = txtType.Text
If type = "W" And 1 >= 4 Then
type = CStr(10)
ElseIf type = "W" And 5 >= 5 Then
type = CStr(9)
Else
type = CStr(0)
End If
If type = "R" And 1 >= 3 Then
type = CStr(15)
ElseIf type = "R" And 4 >= 8 Then
type = CStr(14)
ElseIf type = "R" And 8 >= 8 Then
type = CStr(12)
Else
type = CStr(0)
End If
If IsNumeric(txtUnits.Text) Then
Number = txtUnits.Text
Else
Number = CStr(0)
MessageBox.Show("Error Data is 0.", _
"Marine Packing", MessageBoxButtons.OK, _
MessageBoxIcon.Information, MessageBoxDefaultButton.Button1)
End If
End If
Math = CDec(CDbl(Number) * CDbl(type))
lblDue.Text = Math.ToString("C2")
End Sub
I'm trying to get my form to get the variable "Type" from the entered digit of W or R with the values assigned from there entry. But every time I try, my result always ends up staying zero.
Any help would be greatly appretiated!
__________________
>> Higher a poor college student. PM me :). PHP/MySQL <<
|