VB Code:
'Class member variable
Private bool As Boolean =False
If Not bool Then
While (discountsfile.Peek() > -1)
disc = discountsfile.ReadLine()
pos = InStr(disc, " ")
discamounts = CDbl(Microsoft.VisualBasic.Left(disc, pos - 1))
saleamounts = CInt(Mid(disc, pos + 1))
totalPrice = totalPrice - (totalPrice * (saleamounts / 100))
If totalPrice >= discamounts Then
txtdiscount.Text = Format(totalPrice, "Standard")
bool=True
Exit While
End If
End While
txtPST.Text = Format(PST, "Standard")
bool=True
GST = Math.Round(totalPrice * GSTrate, 2)
txtGST.Text = Format(GST, "Standard")
txtTotalAmount.Text = Format(totalPrice + PST + GST, "Standard")
End If