writing a function in VB 6
Posted on 2004-11-21
I have to make a program that will use functions to solve this problem, but I can't figure it out...
The resonant frequency of an inductor (L) and a capacitor (C), connected in parallel.
Where (f) is frequency in hertz, (L) is the inductance in Henrys, and C is the capacitance in Farads. I have to develop an LCF calculator that uses this formula to calculate and display the value of a third component when the values of any two components are entered into the calculator. This program has to contain three user-written functions, which I have, but the don't work. :( The functions are (and I just need help with the logic, I believe I can do this):
1: return f when L and C are passed
2: Return L when F and C are passed
3: Return C when F and L are passed.
F has to be displayed in Mhz
L has to be displayed in uH
C has to be displayed in pF
the conversion factors are:
1Hz = 10(-6)Mhz
1H = 10(6)uH
1F = 10(12)pF
I have three text boxes, and three cmd buttons on the page.
cmdFindL (the code that fires when this button is clicked is as follows)
Private Sub cmdFindL_Click()
txtL.Text = FindL(txtF.text, txtC.text)
Public Function FindL(byVal f as double, byVal C as Double) as Double
' code here is what I don't get. :(
I can not figure out this formula, please help :(
Thanks in advance. :)