By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,825 Members | 1,708 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,825 IT Pros & Developers. It's quick & easy.

can't use Currency in a function declration!

P: n/a
Hi

I want to use the following declarations but vb dotnet keeps complaining
that currency can't be used because it private ?

I have tried it in a module and in the declaration pare same error!

Private Declare Function QueryPerformanceFrequency Lib "kernel32" (ByVal
lpFrequency As Currency) As Long

Private Declare Function QueryPerformanceCounter Lib "kernel32" (ByVal
lpPerformanceCount As Currency) As Long

Nov 21 '05 #1
Share this Question
Share on Google+
11 Replies


P: n/a
"Adrian" <Ad****@nospamhotmail.com.uk> schrieb
Hi

I want to use the following declarations but vb dotnet keeps
complaining that currency can't be used because it private ?

I have tried it in a module and in the declaration pare same error!

Private Declare Function QueryPerformanceFrequency Lib "kernel32"
(ByVal lpFrequency As Currency) As Long

Private Declare Function QueryPerformanceCounter Lib "kernel32"
(ByVal lpPerformanceCount As Currency) As Long

These are declarations for the wrong language (VB6). In VB.Net:
Private Declare Function QueryPerformanceFrequency Lib "kernel32"
(ByRef lpFrequency As Long) As Boolean

Private Declare Function QueryPerformanceCounter Lib "kernel32"
(byref lpPerformanceCount As long) As boolean
Armin
Nov 21 '05 #2

P: n/a
Thanks for the quick reply and help

"Armin Zingler" <az*******@freenet.de> wrote in message
news:uP*************@TK2MSFTNGP14.phx.gbl...
"Adrian" <Ad****@nospamhotmail.com.uk> schrieb
Hi

I want to use the following declarations but vb dotnet keeps
complaining that currency can't be used because it private ?

I have tried it in a module and in the declaration pare same error!

Private Declare Function QueryPerformanceFrequency Lib "kernel32"
(ByVal lpFrequency As Currency) As Long

Private Declare Function QueryPerformanceCounter Lib "kernel32"
(ByVal lpPerformanceCount As Currency) As Long

These are declarations for the wrong language (VB6). In VB.Net:
Private Declare Function QueryPerformanceFrequency Lib "kernel32"
(ByRef lpFrequency As Long) As Boolean

Private Declare Function QueryPerformanceCounter Lib "kernel32"
(byref lpPerformanceCount As long) As boolean
Armin

Nov 21 '05 #3

P: n/a
Sorry it still gives the same error!?

"Adrian" <Ad****@nospamhotmail.com.uk> wrote in message
news:db**********@nwrdmz02.dmz.ncs.ea.ibs-infra.bt.com...
Thanks for the quick reply and help

"Armin Zingler" <az*******@freenet.de> wrote in message
news:uP*************@TK2MSFTNGP14.phx.gbl...
"Adrian" <Ad****@nospamhotmail.com.uk> schrieb
Hi

I want to use the following declarations but vb dotnet keeps
complaining that currency can't be used because it private ?

I have tried it in a module and in the declaration pare same error!

Private Declare Function QueryPerformanceFrequency Lib "kernel32"
(ByVal lpFrequency As Currency) As Long

Private Declare Function QueryPerformanceCounter Lib "kernel32"
(ByVal lpPerformanceCount As Currency) As Long

These are declarations for the wrong language (VB6). In VB.Net:
Private Declare Function QueryPerformanceFrequency Lib "kernel32"
(ByRef lpFrequency As Long) As Boolean

Private Declare Function QueryPerformanceCounter Lib "kernel32"
(byref lpPerformanceCount As long) As boolean
Armin


Nov 21 '05 #4

P: n/a
this what I'm trying to do, using the code bellow I insert a call to a web
service at the "some code line" and I want to know in milisecs how long it
takes to return a response.

Private Declare Function QueryPerformanceFrequency Lib "kernel32"
(lpFrequency As Currency) As Long
Private Declare Function QueryPerformanceCounter Lib "kernel32"
(lpPerformanceCount As Currency) As Long

Dim curFreq as Currency
Dim curStart as Currency
Dim curEnd as Currency
Dim dblResult as Double

QueryPerformanceFrequency curFreq 'Get the timer frequency
QueryPerformanceCounter curStart 'Get the start time

'Some code to test

QueryPerformanceCounter curEnd 'Get the end time
dblResult = (curEnd - curStart) / curFreq 'Calculate the duration (in
seconds)

taken from http://gpwiki.org/index.php/VB:QueryPerformanceCounter
"Adrian" <Ad****@nospamhotmail.com.uk> wrote in message
news:db**********@nwrdmz01.dmz.ncs.ea.ibs-infra.bt.com...
Sorry it still gives the same error!?

"Adrian" <Ad****@nospamhotmail.com.uk> wrote in message
news:db**********@nwrdmz02.dmz.ncs.ea.ibs-infra.bt.com...
Thanks for the quick reply and help

"Armin Zingler" <az*******@freenet.de> wrote in message
news:uP*************@TK2MSFTNGP14.phx.gbl...
"Adrian" <Ad****@nospamhotmail.com.uk> schrieb
Hi

I want to use the following declarations but vb dotnet keeps
complaining that currency can't be used because it private ?

I have tried it in a module and in the declaration pare same error!

Private Declare Function QueryPerformanceFrequency Lib "kernel32"
(ByVal lpFrequency As Currency) As Long

Private Declare Function QueryPerformanceCounter Lib "kernel32"
(ByVal lpPerformanceCount As Currency) As Long
These are declarations for the wrong language (VB6). In VB.Net:
Private Declare Function QueryPerformanceFrequency Lib "kernel32"
(ByRef lpFrequency As Long) As Boolean

Private Declare Function QueryPerformanceCounter Lib "kernel32"
(byref lpPerformanceCount As long) As boolean
Armin



Nov 21 '05 #5

P: n/a
"Adrian" <Ad****@nospamhotmail.com.uk> schrieb
taken from http://gpwiki.org/index.php/VB:QueryPerformanceCounter

Again, this code is for the wrong language. Well, not the language is wrong,
but you are using it in the wrong place. It is VB6 code. You are probably
using VB.net, aren't you? Both are different. Use my declaration. There is
no Currency data type. Use 'Long' as the parameters according to the
declaration.
Armin

Nov 21 '05 #6

P: n/a
OK thanks again, I will try it when I get home and let you know how it goes!

And yes I'm trying to use VB dotnet

Thanks

"Armin Zingler" <az*******@freenet.de> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
"Adrian" <Ad****@nospamhotmail.com.uk> schrieb
taken from http://gpwiki.org/index.php/VB:QueryPerformanceCounter

Again, this code is for the wrong language. Well, not the language is
wrong,
but you are using it in the wrong place. It is VB6 code. You are probably
using VB.net, aren't you? Both are different. Use my declaration. There is
no Currency data type. Use 'Long' as the parameters according to the
declaration.
Armin

Nov 21 '05 #7

P: n/a
"Adrian" <Ad****@nospamhotmail.com.uk> schrieb:
I want to use the following declarations but vb dotnet keeps complaining
that currency can't be used because it private ?

I have tried it in a module and in the declaration pare same error!

Private Declare Function QueryPerformanceFrequency Lib "kernel32" (ByVal
lpFrequency As Currency) As Long


See:

<URL:http://www.pinvoke.net/default.aspx/coredll/QueryPerformanceCounter%20.html>

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #8

P: n/a
Armin ,,,,,, Long ????

No not long,,, you should use the decimal datatype for currency values

regards

Michel Posseth [MCP]

"Adrian" <Ad****@nospamhotmail.com.uk> schreef in bericht
news:db**********@nwrdmz03.dmz.ncs.ea.ibs-infra.bt.com...
OK thanks again, I will try it when I get home and let you know how it
goes!

And yes I'm trying to use VB dotnet

Thanks

"Armin Zingler" <az*******@freenet.de> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
"Adrian" <Ad****@nospamhotmail.com.uk> schrieb
taken from http://gpwiki.org/index.php/VB:QueryPerformanceCounter

Again, this code is for the wrong language. Well, not the language is
wrong,
but you are using it in the wrong place. It is VB6 code. You are probably
using VB.net, aren't you? Both are different. Use my declaration. There
is
no Currency data type. Use 'Long' as the parameters according to the
declaration.
Armin


Nov 21 '05 #9

P: n/a
"m.posseth" <po*****@planet.nl> schrieb
Armin ,,,,,, Long ????

No not long,,, you should use the decimal datatype for currency
values


They are not currency values.

Currency has been used in VB6 only because there was no other 8 bytes
integer (or better: scaled integer) data type. Now we have Long.
Armin

Nov 21 '05 #10

P: n/a
Armin ,,,
'
I sure remember that when i moved from VB 6 to VB.Net that in the
conversion guides was stated that the decimal datatype should be used to
hold currency values

"Nor is the Currency data type. Instead, use the new Decimal data type,
which can handle more digits on both sides of the decimal point, for all
money variables and calculations. Decimal is also directly supported by the
common language runtime."
after a small search

http://msdn.microsoft.com/library/de...ypechanges.asp
after some googling i found that some people recomend a 64 bit integer to
hold currency values

regards

Michel Posseth
"Armin Zingler" <az*******@freenet.de> schreef in bericht
news:ev**************@TK2MSFTNGP12.phx.gbl...
"m.posseth" <po*****@planet.nl> schrieb
Armin ,,,,,, Long ????

No not long,,, you should use the decimal datatype for currency
values


They are not currency values.

Currency has been used in VB6 only because there was no other 8 bytes
integer (or better: scaled integer) data type. Now we have Long.
Armin

Nov 21 '05 #11

P: n/a
On 2005-07-27, m.posseth <po*****@planet.nl> wrote:
Armin ,,,
'
I sure remember that when i moved from VB 6 to VB.Net that in the
conversion guides was stated that the decimal datatype should be used to
hold currency values

That's true, except in this case - since they aren't storing currency
values. The need a 64-bit integer. In VB6, you had to use a currency
value (since that's what they were interanlly). In VB.NET you use Long,
which is a 64-bit integer.
"Nor is the Currency data type. Instead, use the new Decimal data type,
which can handle more digits on both sides of the decimal point, for all
money variables and calculations. Decimal is also directly supported by the
common language runtime."
after a small search

http://msdn.microsoft.com/library/de...ypechanges.asp
after some googling i found that some people recomend a 64 bit integer to
hold currency values


The decimal data type is a 64-bit integer internally.

--
Tom Shelton [MVP]
Nov 21 '05 #12

This discussion thread is closed

Replies have been disabled for this discussion.