next time mate, could you post even a little code. we just assume about this one.VB Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click ListBox1.Items.Clear() ' clearing Dim n As Integer Try n = Integer.Parse(TextBox1.Text) Catch ex As Exception MessageBox.Show("casting exception") Exit Sub End Try If n < 1 Then MessageBox.Show("bullet proof") ' bullet proof End If ' i assume you put the result to last item of the listbox ListBox1.Items.Add(factorial(n)) End Sub Function factorial(ByVal n As Integer) As Integer If n > 0 Then factorial = n * factorial(n - 1) ListBox1.Items.Add(n) ElseIf n = 0 Then Return 1 End If End Function




Reply With Quote