Solved

Calculation Code

Posted on 2002-05-08
2
123 Views
Last Modified: 2010-05-02
Hi friends,

I have two textboxes in my form.  I would like to be able to type in a math expression in box 1 and when I tab out of that box, I would like the result to show in box 2.  For example, if I type "9 - 5" in box 1 and tab out, I would like "4" to show up in box 2.  Is the code for this really hard?  Would somebody kindly share it with us?  

Thanks, friends.


Jazon Samillano
Jacksonville, FL
0
Comment
Question by:piratepatrol
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 18

Accepted Solution

by:
bobbit31 earned 50 total points
ID: 6997295
easy:

under projects/references choose microsoft script control

then do:
Private Sub Command1_Click()
Dim scr As New ScriptControl

scr.Language = "vbscript"
Text2.Text = scr.Eval(Text1.Text)

End Sub
0
 
LVL 3

Author Comment

by:piratepatrol
ID: 6997314
I LOOOOOOOOOOOVE YOU - whoever you are!  :)  Thank you so much.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question