Calculating Without A Command Button

I was wondering how I can calculate a product of 3 text boxes to a 4th text box without a command button.  I want to multiply Principle * Rate * Time to = Interest without a button you have to click to see the answer.  I am using scroll bars so the number changes when you hit the scroll bar and I want my interest to show up and change also when another thing is changed.  My code is I copied below.  I need to know how to make the product show up without a button.  Please help.  Thank you!

Private Sub hscrPrinciple_Change()
    txtPrinciple.Text = CStr(hscrPrinciple.Value)
End Sub

Private Sub hscrRate_Change()
    txtRate.Text = CStr(hscrRate.Value)
End Sub

Private Sub hscrTime_Change()
    txtTime.Text = CStr(hscrTime.Value)
End Sub

Private Sub txtInterest_Change()
End Sub

Private Sub txtPrinciple_Change()
End Sub

Private Sub txtRate_Change()
End Sub

Private Sub txtTime_Change()
End Sub
moongladeAsked:
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.

ericl1stCommented:
Try this:

Private Sub hscrPrinciple_Change()
   txtPrinciple.Text = CStr(hscrPrinciple.Value)
End Sub

Private Sub hscrRate_Change()
   txtRate.Text = CStr(hscrRate.Value)
End Sub

Private Sub hscrTime_Change()
   txtTime.Text = CStr(hscrTime.Value)
End Sub

Private Sub txtInterest_Change()
End Sub

Private Sub txtPrinciple_Change()
   txtInterest.Text = txtPrinciple.Text * txtRate.Text * txtTime.Text
End Sub

Private Sub txtRate_Change()
   txtInterest.Text = txtPrinciple.Text * txtRate.Text * txtTime.Text
End Sub

Private Sub txtTime_Change()
   txtInterest.Text = txtPrinciple.Text * txtRate.Text * txtTime.Text
End Sub
0

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
MN_DaveCommented:
You could create a function that multiplies the values from the three text boxes and returns the result.  You could then call this function after the assignment in each of your scroll change events....

Private Sub hscrPrinciple_Change()
   txtPrinciple.Text = CStr(hscrPrinciple.Value)
   txtInterest.Text = calc_Interest()
End Sub

Private Sub hscrRate_Change()
   txtRate.Text = CStr(hscrRate.Value)
   txtInterest.Text = calc_Interest()
End Sub

Private Sub hscrTime_Change()
   txtTime.Text = CStr(hscrTime.Value)
   txtInterest.Text = calc_Interest()
End Sub

Private Function calc_Interest() as Single
  code to multiply values and return result goes here...
End Function
0
JacamarCommented:
Well, depending on your exact needs, in each of the change functions you could call a funtion that would ensure that all fields were filled in, and if so, would execute your calculation.  This is a type of real-time procedure that is usually very pleasant to use.  If you want to try this way, I will provide some code.
0
moongladeAuthor Commented:
Code worked great!!!  Thanks sooo much!
0
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.