gettingstarted
[Top] [All Lists]

Re: Equations supplied by user

To: Getting Started <gettingstarted at lists dot realsoftware dot com>
Subject: Re: Equations supplied by user
From: Terry Ford <tmford at shaw dot ca>
Date: Mon, 31 Jan 2005 07:53:41 -0800
Delivered-to: gettingstarted at lists dot realsoftware dot com
References: <BE23F80C dot F5D%hugh dot neill at spitfireuk dot net>

On 31-Jan-05, at 6:58 AM, Hugh Neill wrote:

I have declared the variable x as double. The user will now supply the value
of x in one editfield called Xmin and the function equation in the form
something like x^2 in the next editfield called Relation and declared as
double.

Pushing a button, PushButton1, then should(!) give the value of the
function.

My problem is code for supplying the equation: is it a string or a number?
This is what I have tried.


  dim x as double
  dim relation as double
  dim y as double


  x=Val(xMin.text)
  equation=Val(relation.text)
  y=equation
  MsgBox str(y)

I get two error messages.

* This method or property does not exist in relation.PushButton1.Action,
line 17:
equation=Val(relation.text)

* This method or property does not exist in relation.PushButton1.Action,
line 18:
y=equation

What is going wrong?

By the way I'm from London and it's not raining!

I'm from Vancouver,B.C. Canada and it is raining. :-)

I can't help you in changing a string "x^2" into a function but I can point out the errors you made. One was skipped by the compiler. That might be a bug.

Tip. If you double click on the error message it will highlight the code in error.

1. You Dim relation as double but it is a name of an editfield. As a double, it has no text property.

2. You do not Dim equation to a value.

If you comment out the Dim relation as double and run it you will see the same error messages. Double click on the message and you will see they both now highlight equation.

HTH.

Terry

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://www.realsoftware.com/listarchives/lists.html>

<Prev in Thread] Current Thread [Next in Thread>