x
• Status: Solved
• Priority: Medium
• Security: Public
• Views: 261

# convert Javascript to VB 6

I want to convert below Java script expression to VB 6.0:

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

dec = 3799
logx = 3)

I want equivalent in VB 6.0 ?

Thanks
0
mani_sai
• 3
• 2
1 Solution

Commented:
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

Author Commented:
Thanks

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

Commented:
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

Author Commented:
Thanks

We are calculating density/ viscosity etc...
0

Author Commented:
Thanks
0
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.