writing a function in VB 6

I have to make a program that will use functions to solve this problem, but I can't figure it out...

here goes:

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)
End Sub

Public Function FindL(byVal f as double, byVal C as Double) as Double
    ' code here is what I don't get. :(
End Function


I can not figure out this formula, please help :(  

Thanks in advance. :)
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Stephen MandersonSoftware EngineerCommented:
The formula for the physics equ. is it F=L x C just to confirm, I will make up a program that does it for you, give me 30 mins

Stephen MandersonSoftware EngineerCommented:
Hi there, you can download my example at


Hope this helps you


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Stephen MandersonSoftware EngineerCommented:
The formula should be right, from what i remember from 1st year in uni.
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

brooksreeseAuthor Commented:
Thank you so much for your quick answer, are you sure it is as simple as multiplying and dividing the two numbers depending on what button is pushed?  My program is different, but the code you gave me let me understand more about what I should be doing. :)

Thank you so much for the help, but before I close this out can you help me with one function?

I have to display the results to an accuracy of three decimial places.  Should I do this before the function sends back the result, and how?

Thanks, brooks
Stephen MandersonSoftware EngineerCommented:
I have updated it to round to 3 decimal places.
Stephen MandersonSoftware EngineerCommented:
You can use the existing link to download the updated version.

brooksreeseAuthor Commented:
Wow MrManderson, that is a little too advanced for me - but I can definately learn from it. :)  Thank you very much for your help.  I am going to save your name for future reference, please feel free to do the same for me.

Stephen MandersonSoftware EngineerCommented:
Glad i could help.

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.