468,504 Members | 1,924 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,504 developers. It's quick & easy.

Who knows the .Net equivalent of the Val() function?

I inherited some code from a former employee, who was unable to cut the
umbilical cord from VB6. His code is littered with calls to VB6 functions
like Space(), String(), Left(), Mid(), Right(), Len(), Val(), etc.

I know the .Net equivalents of everything except Val().

Int32.Parse allows you to filter out characters like "$" and "," and
whitespace, but it still can't emulate the Val() function completely.

Alright, who here in this group knows the answer?

Thanks,

Mike
Nov 20 '05 #1
10 4608
* "Mike Wengler" <mikewenglerATprovoxDOTcom> scripsit:
I inherited some code from a former employee, who was unable to cut the
umbilical cord from VB6. His code is littered with calls to VB6 functions
like Space(), String(), Left(), Mid(), Right(), Len(), Val(), etc.
I hope you don't try to replace these handy functions!
I know the .Net equivalents of everything except Val().
There is no 1:1 replacement available.
Int32.Parse allows you to filter out characters like "$" and "," and
whitespace, but it still can't emulate the Val() function completely.


Why not use 'Val'? It's a VB.NET function.

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #2
Cor
Hi Herfried,

Why not use 'Val'? It's a VB.NET function.

That is true but I think not a good answer

:-)

Cor
Nov 20 '05 #3
Cor,

* "Cor" <no*@non.com> scripsit:
Why not use 'Val'? It's a VB.NET function.

That is true but I think not a good answer


[Write your answer here]

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #4
I think somebody forgot to fill in his mail template :-p

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:bv************@ID-208219.news.uni-berlin.de...
Cor,

* "Cor" <no*@non.com> scripsit:
Why not use 'Val'? It's a VB.NET function.

That is true but I think not a good answer


[Write your answer here]

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>

Nov 20 '05 #5
Cor
> Cor,
Why not use 'Val'? It's a VB.NET function.

That is true but I think not a good answer


[Write your answer here]

Why not use 'Val'? It's a function from .Net.

:-))))

Cor
Nov 20 '05 #6
Val is evil ..... Regex.Match coupled with ^\d*
"Mike Wengler" <mikewenglerATprovoxDOTcom> wrote in message
news:u1**************@TK2MSFTNGP12.phx.gbl...
I inherited some code from a former employee, who was unable to cut the
umbilical cord from VB6. His code is littered with calls to VB6 functions
like Space(), String(), Left(), Mid(), Right(), Len(), Val(), etc.

I know the .Net equivalents of everything except Val().

Int32.Parse allows you to filter out characters like "$" and "," and
whitespace, but it still can't emulate the Val() function completely.

Alright, who here in this group knows the answer?

Thanks,

Mike

Nov 20 '05 #7
Herfried:
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:bv*************@ID-208219.news.uni-berlin.de...
* "Mike Wengler" <mikewenglerATprovoxDOTcom> scripsit:
I inherited some code from a former employee, who was unable to cut the
umbilical cord from VB6. His code is littered with calls to VB6 functions like Space(), String(), Left(), Mid(), Right(), Len(), Val(), etc.


I hope you don't try to replace these handy functions!
I know the .Net equivalents of everything except Val().


There is no 1:1 replacement available.
Int32.Parse allows you to filter out characters like "$" and "," and
whitespace, but it still can't emulate the Val() function completely.


Why not use 'Val'? It's a VB.NET function.

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>

You are wayyy too cool to like those functions..please tell me it's just
some of that Austrian sarcasm ;-)
Nov 20 '05 #8
just use
microsoft.VisualBasic.Val()

the microsoft.visualbasic class has all the old VB functions and they work
exactly the same..

"Mike Wengler" <mikewenglerATprovoxDOTcom> wrote in message
news:u1**************@TK2MSFTNGP12.phx.gbl...
I inherited some code from a former employee, who was unable to cut the
umbilical cord from VB6. His code is littered with calls to VB6 functions
like Space(), String(), Left(), Mid(), Right(), Len(), Val(), etc.

I know the .Net equivalents of everything except Val().

Int32.Parse allows you to filter out characters like "$" and "," and
whitespace, but it still can't emulate the Val() function completely.

Alright, who here in this group knows the answer?

Thanks,

Mike

Nov 20 '05 #9
Cor
Hi Bill,

I think it has nothing to do with sarcasme.

There seems a strange thinking with some people who think that by limiting
themself by only using the System part they are programming for the Net.

Cor
Nov 20 '05 #10
* "Cor" <no*@non.com> scripsit:
I think it has nothing to do with sarcasme.

There seems a strange thinking with some people who think that by limiting
themself by only using the System part they are programming for the Net.


Full ACK.

;-)

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #11

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Phil Powell | last post: by
9 posts views Thread by neerolyte | last post: by
20 posts views Thread by Praveen | last post: by
5 posts views Thread by jose g. de jesus jr mcp, mcdba | last post: by
9 posts views Thread by Alan Silver | last post: by
10 posts views Thread by cppquester | last post: by
8 posts views Thread by Derek Martin | last post: by
3 posts views Thread by gieforce | last post: by
reply views Thread by fmendoza | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.