VB6 Equivalent of VBA Eval() function ? 
Author Message
 VB6 Equivalent of VBA Eval() function ?

There is no VB equivalent of the Eval function. Such functions are usually
unique to interpreted languages, and because VB is not an interpreted
language, the code cannot be interpreted at runtime. However, it is possible
to use the same Eval function that is used by IE by adding a "Microsoft
Script Control" to your form. The script control has an Eval method that you
can use. This control can be found in the Project | Components dialog box.

Jason Bouzane


Quote:

> Hi

> I'm converting an appliction written in VBA (Access 2.0) to
> VB 6. In this app the Eval() function is used to calculate
> a formula stored as a string in the database.

> Something like;

> Dim sExpr as string
> Dim iAnswer as Integer

> sExpr = "2+2"
> iAnswer = Cint(Eval(sExpr))

> iAnswer becomes 4.

> Does anybody know the VB6 equivalent of this function.
> I can't seem to find the answer in MSDN or KB.

> TIA Leon



Mon, 24 Feb 2003 22:59:39 GMT  
 VB6 Equivalent of VBA Eval() function ?

Sorry Jason but there's no 'Microsoft Script Control' in my
components . I'm using VB6 ent.



Quote:
> There is no VB equivalent of the Eval function. Such functions are usually
> unique to interpreted languages, and because VB is not an interpreted
> language, the code cannot be interpreted at runtime. However, it is
possible
> to use the same Eval function that is used by IE by adding a "Microsoft
> Script Control" to your form. The script control has an Eval method that
you
> can use. This control can be found in the Project | Components dialog box.

> Jason Bouzane



> > Hi

> > I'm converting an appliction written in VBA (Access 2.0) to
> > VB 6. In this app the Eval() function is used to calculate
> > a formula stored as a string in the database.

> > Something like;

> > Dim sExpr as string
> > Dim iAnswer as Integer

> > sExpr = "2+2"
> > iAnswer = Cint(Eval(sExpr))

> > iAnswer becomes 4.

> > Does anybody know the VB6 equivalent of this function.
> > I can't seem to find the answer in MSDN or KB.

> > TIA Leon



Mon, 24 Feb 2003 23:33:56 GMT  
 VB6 Equivalent of VBA Eval() function ?
What version of IE are you using? I have 5.5. I don't know if this control
is available in earlier versions. Check your system directory for the
msscript.ocx file. If it's there, use the browse button in the Components
dialog box to register it for use in VB.

Jason Bouzane


Quote:

> Sorry Jason but there's no 'Microsoft Script Control' in my
> components . I'm using VB6 ent.



> > There is no VB equivalent of the Eval function. Such functions are
usually
> > unique to interpreted languages, and because VB is not an interpreted
> > language, the code cannot be interpreted at runtime. However, it is
> possible
> > to use the same Eval function that is used by IE by adding a "Microsoft
> > Script Control" to your form. The script control has an Eval method that
> you
> > can use. This control can be found in the Project | Components dialog
box.

> > Jason Bouzane



> > > Hi

> > > I'm converting an appliction written in VBA (Access 2.0) to
> > > VB 6. In this app the Eval() function is used to calculate
> > > a formula stored as a string in the database.

> > > Something like;

> > > Dim sExpr as string
> > > Dim iAnswer as Integer

> > > sExpr = "2+2"
> > > iAnswer = Cint(Eval(sExpr))

> > > iAnswer becomes 4.

> > > Does anybody know the VB6 equivalent of this function.
> > > I can't seem to find the answer in MSDN or KB.

> > > TIA Leon



Tue, 25 Feb 2003 00:26:26 GMT  
 VB6 Equivalent of VBA Eval() function ?

Quote:
> What version of IE are you using? I have 5.5. I don't know if this control
> is available in earlier versions. Check your system directory for the
> msscript.ocx file. If it's there, use the browse button in the Components
> dialog box to register it for use in VB.
> Jason Bouzane


>> Sorry Jason but there's no 'Microsoft Script Control' in my
>> components . I'm using VB6 ent.

If you don't have the msscript.ocx file, you can download the script
control from Microsoft, at

http://msdn.microsoft.com/scripting/scriptcontrol/scdown.htm

--



Tue, 25 Feb 2003 02:29:44 GMT  
 VB6 Equivalent of VBA Eval() function ?

Quote:
> Does anybody know the VB6 equivalent of this function.

If you don't have it already, then download the free Script Control:

http://msdn.microsoft.com/scripting/

Then use it as explained here:

http://www.deja.com/[ST_rn=ps]/getdoc.xp?AN=614024724&fmt=text

Regards, Otser.



Tue, 25 Feb 2003 07:17:38 GMT  
 VB6 Equivalent of VBA Eval() function ?

Thanks All,

With a reference to the scriptcontrol
I can do what i intended to do.

Regards Leon



Tue, 25 Feb 2003 15:41:14 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. VB equivalent of VBA eval()?

2. VB Equivalent for Eval() {Access Basic} or Indirect() {Excel} functions

3. What is equivalent to Eval() function?

4. VB Equivalent for Eval() {Access Basic} or Indirect() {Excel} functions

5. Function equivalent to VBScript's Eval

6. Eval function in VBA, but not VB?

7. Italian VBA function equivalents?

8. VB's equivalent voor VBA function: IsObjectValid

9. VB6 String$ function equivalent

10. Eval equivalent

11. Equivalent to JavaScript eval in VBScript

12. Equivalent to the javascript Eval() in VB?

 

 
Powered by phpBB® Forum Software