Solved

convert Javascript to VB 6

Posted on 2014-01-13
5
234 Views
Last Modified: 2014-01-14
I want to convert below Java script expression to VB 6.0:

return lead + "." +  dec + "E" +  logX;


(lead = 86
dec = 3799
logx = 3)



I want equivalent in VB 6.0 ?



Thanks
0
Comment
Question by:mani_sai
  • 3
  • 2
5 Comments
 
LVL 12

Expert Comment

by:HugoHiasl
ID: 39777691
The expression would be

CStr(lead) &  "." & CStr(dec) & "E" & CStr(logX)


If it is with in a function then you need to assign this value to the name of the function

function test  as string
  test  = CStr(lead) &  "." & CStr(dec) & "E" & CStr(logX)
end function
0
 
LVL 8

Author Comment

by:mani_sai
ID: 39777696
Thanks

My function is returning back as double...  Can we convert the output to double?
0
 
LVL 12

Accepted Solution

by:
HugoHiasl earned 500 total points
ID: 39777977
I assume it is a geographical information. Then it is wrong built.

86.3799 would be a valid value...

86.3799E3 would convert to 86379.9  as double. This is not a valid value

DIM myString
DIM myValue as Double

myString = CStr(lead) & "." & CStr(dec)

myValue = CDbl(myString)
myValue = myValue * (10^logX)

Now myValue should have a valid value. EXXX in a scientfic notation is doing nothing else than shifting the decimal point.
0
 
LVL 8

Author Comment

by:mani_sai
ID: 39777990
Thanks

We are calculating density/ viscosity etc...
0
 
LVL 8

Author Closing Comment

by:mani_sai
ID: 39780696
Thanks
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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

Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …

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