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

Select Case Not Catching Decimal Type

P: n/a
Okay, so I have the chunk of code below which is trying to determine the
value of a decimal. No matter what I do, none of the case statements are
entered. I've tried several different formats of the "Case dTotal > 0D"
such as...

-Case (dTotal > 0)
-Case dTotal > 0D
-Case dTotal > 0.0
-Case dTotal > 0.0D

....but absolutely none of them are entered! What is going on here? Below
is the abbreviated chunk of code I'm using...

Dim dRepExpenses, dTotalAdvances, dProdPurchaseAmt, dTotal As Decimal
Try
dRepExpenses = CDec(txtRepFee.Text) + CDec(txtShippingFees.Text) +
CDec(txtMiscFees.Text)
dTotalAdvances = CDec(lblTotalAdvValue.Text)
dProdPurchaseAmt = CDec(lblProdPurchaseValue.Text)
dTotal = dRepExpenses + (dProdPurchaseAmt - dTotalAdvances)

Select Case dTotal
Case dTotal > 0D
lblTotalToRepValue.Text = CStr(dTotal) //**NEVER GETS HERE
Case dTotal < 0D
lblTotalToRQAValue.Text = CStr(dTotal) //**NEVER GETS HERE
Case dTotal = 0D
lblTotalToRepValue.Text = 0 //**NEVER GETS HERE
lblTotalToRQAValue.Text = 0
End Select
Catch E As Exception
Throw E
End Try

Thanks,

Kyle
Nov 20 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
"Kyle Novak" <kn****@nowhere.com> schrieb
Select Case dTotal
Case dTotal > 0D


Enable Option Strict in the project properties.
--
Armin

http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #2

P: n/a
* "Kyle Novak" <kn****@nowhere.com> scripsit:
Okay, so I have the chunk of code below which is trying to determine the
value of a decimal. No matter what I do, none of the case statements are
entered. I've tried several different formats of the "Case dTotal > 0D"
such as...

-Case (dTotal > 0)
-Case dTotal > 0D
-Case dTotal > 0.0
-Case dTotal > 0.0D

...but absolutely none of them are entered! What is going on here? Below
is the abbreviated chunk of code I'm using...


Read the documentation for 'Select Case' and 'Option Strict On'...

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.