Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Getting negitive Number

Posted on 2004-10-25
1
Medium Priority
?
189 Views
Last Modified: 2012-05-05
Can somoen please explain to me why I would get a negative number if I enter 355 into the textbox.

---------------------------------------------------------
Private mdblHouseSqFt As Double = 0
Select Case txtHomeSqFt.Text
            Case 0 To 1000
                mdblHouseSqFt = txtHomeSqFt.Text * 0.1
            Case 1001 To 2000
                mdblHouseSqFt = ((txtHomeSqFt.Text - 1000) * 0.11) + 100
            Case 2001 To 3000
                mdblHouseSqFt = ((txtHomeSqFt.Text - 2000) * 0.12) + 210
            Case 3001 To 4000
                mdblHouseSqFt = ((txtHomeSqFt.Text - 3000) * 0.13) + 330
            Case Else
                mdblHouseSqFt = ((txtHomeSqFt.Text - 4000) * 0.14) + 460
        End Select
txtTaxOnHome.Text = mdblHouseSqFt
-----------------------------------------------------------

Thanks.
0
Comment
Question by:Jedidia
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 86

Accepted Solution

by:
Mike Tomlinson earned 200 total points
ID: 12400073
Because you are using a string as the case parameter but the values in your case statements are numbers so it is jumping to the Case Else all the time.

Change

    Select Case txtHomeSqFt.Text

to

    Select Case CInt(txtHomeSqFt.Text)

~IM
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String (http://msdn.microsoft.com/en-us/library/system.string.aspx) Literal, only instead of starting and ending with w…
A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question