strItemCode |
decTaxRate |
strCategory |
lblCategory.Text |
lblTaxRate.Text |
|
1) |
1356344 |
.01 |
Food, Drugs, Medical |
Food, Drugs, Medical |
1.00% |
2) |
823432 |
.065 |
Food for immediate consumption |
Food for immediate consumption |
6.50% |
3) |
5879872 |
.0725 |
General Merchandise |
General Merchandise |
7.25% |
4) |
2536343 |
.0725 |
General Merchandise |
General Merchandise |
7.25% |
5) |
KL34782 |
ERROR |
ERROR |
||
6) |
9578555 |
.065 |
Food for immediate consumption |
Food for immediate consumption |
6.50% |
7) |
0067686 |
.01 |
Food, Drugs, Medical |
Food, Drugs, Medical |
1.00% |
If IsNumeric(strItemCode) = False Then
lblTaxRate.Text = "ERROR"
lblCategory.Text = "ERROR"
Else
Select Case strItemCode.Substring(0,
1)
Note: The SubString() method returns a string. The string returned is a substring of the contents of the strItemCode variable starting from the nth character (n being the first argument, base 0) for x number of characters (x being the second argument passed)
Case "0", "1", "7"
decTaxRate = .01
strCategory = "Food, Drugs, Medical"
Case Is >= "8"
decTaxRate = 0.065
strCategory = "Food for immediate
consumption"
Case "2" To "6"
decTaxRate = 0.0725
strCategory = "General Merchandise"
End Select
lblCategory.Text = strCategory
lblTaxRate.Text = FormatPercent(decTaxRate, 2)
End If