472,950 Members | 2,395 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,950 software developers and data experts.

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 4802
* "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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Phil Powell | last post by:
I need to find a PHP equivalent to a very familiar TCL command "subst" (see http://www.hume.com/html84/mann/subst.html ). This command will take a string and evaluate anything TCL inside of it...
9
by: neerolyte | last post by:
How would I pass an object variable to a function without that variable getting changed in the function changing the variable that was passed (eg both variables treated as one)? <script> var a...
20
by: Praveen | last post by:
Hi All, I have an application for that we used oracle 8i as the db and we have written procedures using VARRAYs. Now, the requirement came to migrate it on DB2 UDB. Can anyone pls tell me is...
21
by: google | last post by:
I'm trying to implement something that would speed up data entry. I'd like to be able to take a string, and increment ONLY the right-most numerical characters by one. The type structure of the...
5
by: jose g. de jesus jr mcp, mcdba | last post by:
vb.net val function c=val(a$)+val(b$) thanks
9
by: Alan Silver | last post by:
Hello, I'm converting some old VB6 code to use with ASP.NET and have come unstuck with the Asc() function. This was used in the old VB6 code to convert a character to its ASCII numeric...
1
by: aum | last post by:
Hi, Does Javascript have any equivalent to Python's __getattr__ and __setattr__ methods? In other words, the option to define a method of a class that gets invoked whenever someone tries to...
10
by: cppquester | last post by:
I got an app where a bunch of values are set before the calculation is fired up. I need an elegant way to check if all variables have been set. So for example for double I am thinking about a ...
8
by: Derek Martin | last post by:
I'd like to know if it's possible to code something in Python which would be equivalent to the following C: ---- debug.c ---- #include <stdio.h> bool DEBUG;
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Sept 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.