Can someone explain to me why this code do not try to perform the loop? It just crashes my program:(
Private Sub btnCommission_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCommission.Click
Dim strComAmount As String
Dim decComAmount As Decimal
Dim decAverageCom As Decimal
Dim decTotalOfAllCom As Decimal = 0D
Dim intNumberOfEntry As Integer
'convert textbox data into decimal
strComAmount = Me.txtCommission.Text
decComAmount = Convert.ToDecimal(strComAmount)
'Initiate the loop
While decComAmount > 0
Me.lstTally.Items.Add(decComAmount)
intNumberOfEntry += 1
decTotalOfAllCom += decComAmount
End While
'Calculate Average
decAverageCom = decTotalOfAllCom / intNumberOfEntry
'Display Total and count
Me.lblTotal.Text = decAverageCom.ToString("C")
Me.lblCount.Text = CStr(intNumberOfEntry)
Me.lblAverage.Text = decAverageCom.ToString("C")
If decComAmount < 0 Then
MessageBox.Show("Please enter more than one dollar")
End If
End Sub