473,395 Members | 1,379 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,395 software developers and data experts.

can't use Currency in a function declration!

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

Similar topics

1
by: Bill Stanard | last post by:
I have had no success using the format function as follows (the two lines of code run one after the other): 'displays a running total of lblAmtdue.Caption 'contents in txtTotal.Text...
2
by: Willing 2 Learn | last post by:
I'm still having trouble getting my program to do arithmetic in cents(keeping all #'s) then convert the answer in a format of dollars & cents. The main program should add, subtract, scalar...
2
by: zlf | last post by:
Hi, Run this code will cause format exception. I think the problem is induced by using System.Globalization.NumberStyles.Currency since I used customed currency symbol("My Dollar:"). Please tell...
6
by: Mitchell Vincent | last post by:
Just making sure I'm not missing the boat here, but are there any special routines for doing currency math (fixed precision stuff) in .NET? The wonderful problems of doing math on decimals tend...
4
by: Paul H | last post by:
OK, I tried getting and old Newbury Data ND2500 working using the "Generic /Text only" driver in Win XP. It prints, but I could not find a way to set a custom page size that matches the paper I am...
7
by: meenasamy | last post by:
Hi all, i need to create a function that takes three parameters( Original currency, needed currency, amount) i need to convert from the original currency to the needed currency the amount and...
2
by: sck10 | last post by:
Hello, I have a SQL Server 2K table with a field set to currency. When I try to insert or update a FormView, I get the following error: Disallowed implicit conversion from data type nvarchar...
2
by: labcheung | last post by:
Hi all: I am working on Access 2000 with SP3. The problem is the sum of currency has $0.01 difference on the total even I use the same equation on all forms. I have a product which costs...
4
by: etuncer | last post by:
Hello All, I have Access 2003, and am trying to build a database for my small company. I want to be able to create a word document based on the data entered through a form. the real question is...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.