Three greater then less then statements and not getting correct calculation

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • CJ Densmore
    New Member
    • Dec 2010
    • 4

    #1

    Three greater then less then statements and not getting correct calculation

    For program to work, you select one of two radio buttons and get a different calculation based on each...

    I have tried every form of algebraic greater then, less then, etc. When I run the program and select retailer (bolded and underlined code), any number above 10 calculate to the number that is supposed to be for the numbers 4 to 9. What am I doing wrong? As requested, I wrote the multiplication outside of the select case structure... Thank you!

    Code:
    Public Class Form1
    
    Private Sub exitButton1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles exitButton1.Click
    
    Me.Close()
    
    End Sub
    
    Private Sub submitButton1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles submitButton1.Click
    
    Dim wholesale As String
    
    Dim inputquantity As Integer
    
    Dim outtotal As Integer
    
    Dim retailer As String
    
    Dim numx As Integer
    
    wholesale = wholesaleRadioButton1.Checked
    
    retailer = retailerRadioButton2.Checked
    
    inputquantity = unitsNeededTextBox1.Text
    
    
    
    Integer.TryParse(totaloutputLabel2.Text, outtotal)
    
    
    
    Select Case True
    
    
    Case wholesale
    
    If inputquantity <= 4 Then
    
    numx = 10
    
    ElseIf inputquantity >= 5 Then
    
    numx = 9
    
    End If
    
    Case retailer
    
    
    [B][U]If inputquantity <= 3 Then
    
    numx = 15
    
    ElseIf 4 > inputquantity < 9 Then
    
    numx = 14
    
    ElseIf inputquantity >= 10 Then
    
    numx = 13[/U][/B]
    
    End If
    
    End Select
    
    outtotal = numx * inputquantity
    
    totaloutputLabel2.Text = outtotal
    
    End Sub
    
    End Class
    Last edited by Stewart Ross; Dec 7 '10, 02:24 PM. Reason: corrected code tags
  • Rodney Roe
    New Member
    • Oct 2010
    • 61

    #2
    I don't know if this'll help but at line 55 try this"

    Code:
    ElseIf inputquantity > 3 And inputquantity < 10
    this'll work for range 4 to 9

    Comment

    Working...