English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

i need to make a visual basic project that when you press a command button. it will show the fibonacci sequence (1, 1, 2, 3, 5, 8, ...) using the for..next loop. please help me. how will i do it?

2007-01-13 13:05:43 · 3 answers · asked by Anonymous in Computers & Internet Programming & Design

3 answers

dim i as integer
dim first as integer
dim second as integer
dim answer as integer

in side the button click sub routine
text1.txt = "" 'clears the text box
first = 1: second = 1 'sets first and second variables to 1
for i = 1 to (what ever limit you want so long as its an integer)
answer = first + second 'adds first two integers
text1.txt = text1.txt & str(answer) & VBNewLine 'converts answer to a string to place in text box and adds a new line
second = first: first = answer
next i

You will need to create a text box and a button this code should work.

2007-01-13 14:33:13 · answer #1 · answered by ikeman32 6 · 2 0

My husband, who works in GIS, says to go to the google groups and find the VB group, there are a lot of people all over the world that can help you with your problem. (You will have to explain the problem that you have in detail... )

2007-01-13 21:15:15 · answer #2 · answered by iluvafrica 5 · 0 2

E-mail me wat u want. If it involves forms then sorry.

2007-01-13 21:12:16 · answer #3 · answered by Best Helper 4 · 0 2

fedest.com, questions and answers