PeterK,
In addition to the other comments:
You can use the Conversion Operators the SqlMoney defines to convert to/from
Decimal & SqlMoney along with the Conversion operators that VB defines to
convert to/from Decimal & Double.
http://msdn.microsoft.com/library/de...rsionTopic.asp http://msdn.microsoft.com/library/de...rsionTopic.asp
The "problem" is that VB 2002 & 2003 do not normally see the above
conversion operators. You need to use "Tools - Options - Text Editor -
Basic - General - Hide Advanced members" to show or hide the above advance
members. Once the above members are shown, you can use Intellisense on them.
Something like:
Dim money As SqlTypes.SqlMoney
Dim dollar As Double
money = SqlTypes.SqlMoney.op_Implicit(CDec(dollar))
dollar = SqlTypes.SqlMoney.op_Explicit(money)
VB 2005 (aka Whidbey, due out Nov 7th 2005) will have full support for
overloading conversion operators, so the above two methods will work with
CType!
Something like (untested):
' VB 2005 syntax
Dim money As SqlTypes.SqlMoney
Dim dollar As Double
money = dollar
dollar = CDec(money)
' alternatively you can use CType directly
money = CType(dollar, SqlTypes.SqlMoney)
dollar = CType(money, Double)
NOTE: I have not tested the above, you may need to convert to/from Decimal
first, then explicitly convert to/from Decimal & Double. I don't remember if
it allows two implicit conversions in a row (SqlMoney to Decimal, then
Decimal to Double). In other words you may need:
money = CType(CType(dollar, Decimal), SqlTypes.SqlMoney)
- or -
money = CType(CDec(dollar), SqlTypes.SqlMoney)
Remember that CDec(?) is short hand for CType(?, Decimal).
Hope this helps
Jay
"PeterK" <p.*****@verizon.net> wrote in message
news:Ot**************@TK2MSFTNGP09.phx.gbl...
|I am trying to set Public overridable CreditlimitS() as
| System.Data.SqlTypes.SqlMoney to Creditlimit as Double
| like CreditLimitS=creditlimit
| and get this error "Value of type double cannot be converted to
| System.Data.SqlTypes.SqlMoney "
| How do I get creditlimit into creditlimitS?
| There seems to be no conversion function.
| TIA
|
|