Aditya Om Aditya Om - 1 year ago 62 Question

Is it possible to convert vb6 "Val()" to c#?

I am currently converting vb and to c# but have an issue. I would strongly like not to use the visualbasic dlls in the converted code and have been doing this fine so far.

But this code

Dim x as Double 'this was error saying it was integer
x = Val("1 23 45 x 6") ''#x is 12345
x = Val("1..23") ''#x is 1.23
x = Val("1 1,,,,,2,2..3") ''#x is 1122.3

Does not work the same as vb6 even with using "Val" from the visualbasic.conversion.dll Is there anyone that has solved this to work the same? A c# solution would be best.

Answer Source

Check out this site: where others give an example how to implement your own Val() function.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download