VB Code:
  1. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  2.       ListBox1.Items.Clear()  ' clearing
  3.       Dim n As Integer
  4.       Try
  5.          n = Integer.Parse(TextBox1.Text)
  6.       Catch ex As Exception
  7.          MessageBox.Show("casting exception")
  8.          Exit Sub
  9.       End Try
  10.       If n < 1 Then
  11.          MessageBox.Show("bullet proof")   '  bullet proof
  12.       End If
  13.       '  i assume you put the result to last item of the listbox
  14.       ListBox1.Items.Add(factorial(n))
  15.    End Sub
  16.  
  17.    Function factorial(ByVal n As Integer) As Integer
  18.       If n > 0 Then
  19.          factorial = n * factorial(n - 1)
  20.          ListBox1.Items.Add(n)
  21.       ElseIf n = 0 Then
  22.          Return 1
  23.       End If
  24.    End Function
next time mate, could you post even a little code. we just assume about this one.