Public Class Form1
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
End
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim n As Long
n = TextBox1.Text
If n = 0 Then
Form2.TextBox1.Text = 0
Form2.Show()
Me.Hide()
ElseIf n = 1 Then
Form2.TextBox1.Text = 1
Form2.Show()
Me.Hide()
ElseIf n < 0 Then
MsgBox("No existe suceción de numeros Negativos", MsgBoxStyle.Information)
TextBox1.Text = ""
ElseIf n >= 2 Then
Form2.TextBox1.Text = Fibon(n)
Form2.Show()
Me.Hide()
End If
End Sub
Private Function Fibon(ByVal n As Long) As Long
Dim num As Long
If n = 1 Or n = 2 Then
num = 1
Else
num = Fibon(n - 2) + Fibon(n - 1)
End If
Return num
End Function
End Class
Public Class Form2
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Form1.TextBox1.Text = ""
Form1.Show()
Me.Hide()
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
End
End Sub
End Class