Question: Hi This Lab must be Written in Visual Basic language. Thanks for your help MultiForm Communication In an application that contains multiple forms, those forms
Hi This Lab must be Written in Visual Basic language. Thanks for your help
MultiForm Communication
In an application that contains multiple forms, those forms often need to communicate (pass data) to one another. In this lab, youll learn and practice techniques for communication between forms.
The program that youll work with uses Fibonacci numbers to generate approximations of the Golden Ratio.
Discussion
The program has been started for you and is available in the Downloads section below.
The Fibonacci numbers are values associated with the Fibonacci sequence, which is:
where, except for the first two numbers, each number is the sum of the preceding two numbers.
Fibonacci numbers have the unique property that the ratio of adjacent Fibonacci numbers approach the value of the Golden Ratio:
Golden Ration =
For example,
1/1=1
=0.5
2/3=0.66667
3/5=0.6
5/8=0.625
8/13=0.61538
,
The main form GUI consists of:
A label where a calculated value of the Golden Ratio will be displayed (using the formula above)
A large output label where two consecutive Fibonacci numbers and their ratio will be displayed (see example output below)
Two buttons:
A Go! button, which will spawn a modal new form where input and calculations will be performed
An Exit button (self explanatory)
Initial MainForm.
When the Go! button is clicked, the new form GUI consists of:
A large label that displays directions
A labeled text box for the user to supply a value of N to calculate the ratio of the Nth and the (N + 1)th Fibonacci numbers
A Calculate button
The new form with user input N = 4 waiting. Note, from the sequence above, that the 4th Fibonacci number is 3.
MainForm after Calculate button click in new form.
Looking at the MainForm.vb code, notice that:
The directions that need to be placed in the new forms DirectionsLabel.Text property are found in the MainForm.Directions class variable
The Go! buttons click-event handler creates a local variable, GenerateGoldenWindow, with a GenerateGoldenForm object, but it does not use this object
Looking at the GenerateGoldenForm.vb code, notice that there are assignments to a non-existent variable named Output. These statements load Output with string data that must be displayed in the main form (see the output screen capture above).
Take a look at the code in FibonacciModule.vb to see how the calculated value of the Golden Ratio and the Nth Fibonacci number are generated.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
