473,326 Members | 2,655 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

VB 6 ABS equivlent

hi,
what would be vb.net equivlent to vb 6 abs function
for example
datediff(dateinterval.day,#11/1/2008#,#10/1/2008#) returns -31
if the date were reversed it would be 31
either way.. I want 31 to be the answer
Jun 27 '08 #1
3 1608
>returns -31
if the date were reversed it would be 31
either way.. I want 31 to be the answer
Simple solution could be

Dim ret as integer =datediff(dateinterval.day,#11/1/2008#,#10/1/2008#)
if ret <0 then ret=ret * -1

as math rules say - * - = + :-)

regards
Michel Posseth
"Brian" <bs********@community.nospamschreef in bericht
news:OZ**************@TK2MSFTNGP05.phx.gbl...
hi,
what would be vb.net equivlent to vb 6 abs function
for example
datediff(dateinterval.day,#11/1/2008#,#10/1/2008#) returns -31
if the date were reversed it would be 31
either way.. I want 31 to be the answer

Jun 27 '08 #2
math.abs(datediff(dateinterval.day,#11/1/2008#,#10/1/2008#) )

"Brian" <bs********@community.nospamschreef in bericht
news:OZ**************@TK2MSFTNGP05.phx.gbl...
hi,
what would be vb.net equivlent to vb 6 abs function
for example
datediff(dateinterval.day,#11/1/2008#,#10/1/2008#) returns -31
if the date were reversed it would be 31
either way.. I want 31 to be the answer

Jun 27 '08 #3
"Brian" <bs********@community.nospamschrieb
hi,
what would be vb.net equivlent to vb 6 abs function
for example
datediff(dateinterval.day,#11/1/2008#,#10/1/2008#) returns -31 if
the date were reversed it would be 31
either way.. I want 31 to be the answer

Dim days As Integer

days = CInt(Math.Abs(#11/1/2008#.Subtract(#10/1/2008#).TotalDays))
Armin

Jun 27 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: walala | last post by:
Dear all, I recently came across a Python program which used "telnetlib" to automate things in the several unix machines in our local networks; I attached the script as follows; I wonder if...
21
by: Sriek | last post by:
hi, i come from a c++ background. i ws happy to find myself on quite familiar grounds with Python. But, what surprised me was the fact that the __init__(), which is said to be the equivlent of the...
0
by: Chris N | last post by:
I have an ocx control that is distributed via a Web Page. It is currently written in VB6. Is their an equivlent to the ocx in .Net. If so will I have to install the .Net framework on every PC...
4
by: Raghavendra Mahuli | last post by:
Hi, I have many strings. I have to sort them. But sorting is not according to ascii but according to a different format (which keeps varying) . So i can sort them based on sort-order. It is not...
12
by: rockocubs | last post by:
Is there a way in Javascript to bring up dialog boxes for both opening and then also saving a file?
3
by: James Stroud | last post by:
Hello All, I'm running 2.3.4 I was reading the documentation for classes & types http://www.python.org/2.2.3/descrintro.html And stumbled on this paragraph: """ __new__ must return an...
3
by: _V_ | last post by:
Well, I'm not really interested in PacMan. I'm curious about whether C# is good for java-type graphic-oriented 'applets' that will play in a browser (from a web page). If so, is this covered in...
1
by: DanO | last post by:
I am trying to convert a text string in to hex values. I am at a loss of how to get this done. I am also some what new to VC I have worked in Unix C for a while though. I am been searching the...
2
by: ChrisWoodruff | last post by:
I post a long ol' message about something I was doing... after reading my post it seemed really long (sorry). So I can shorten the question: What's the "proper" VB .NET method for achiving the...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.