0% found this document useful (0 votes)
20 views

Exercise 18

This Visual Basic code defines a class with a button click event handler that calculates Fibonacci numbers. It takes the values entered in two text boxes, adds them together to get the next number, updates the values, and repeats until the number is greater than 5000, outputting the results to a third text box separated by commas.

Uploaded by

api-308657631
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views

Exercise 18

This Visual Basic code defines a class with a button click event handler that calculates Fibonacci numbers. It takes the values entered in two text boxes, adds them together to get the next number, updates the values, and repeats until the number is greater than 5000, outputting the results to a third text box separated by commas.

Uploaded by

api-308657631
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)


Handles Button1.Click
Dim a As Integer = TextBox1.Text
Dim b As Integer = TextBox2.Text
Dim fib As Integer

Do
TextBox3.Text += a.ToString + ","
fib = a + b
a=b
b = fib
Loop While a <= 5000

End Sub
End Class

You might also like