Select Case Not Catching Decimal Type

  • Thread starter Thread starter Kyle Novak
  • Start date Start date
K

Kyle Novak

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
 
* "Kyle Novak said:
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'...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top