Results 1 to 5 of 5

Thread: Make sure one input is always bigger than the other

Threaded View

  1. #1

    Thread Starter
    New Member
    Join Date
    Oct 2009
    Posts
    3

    Make sure one input is always bigger than the other

    Hi

    Please help me with this code

    I would like to know how to make my l(length) always bigger than w(width).
    eg: message box "Make Length bigger than width" and the 2 inputs, and 3 outputs = [blank]

    Code:
    Public Class Form1
    Dim min, max As Integer
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    Dim l, w, tl, r, x, rr As Integer
    
    Call numbercheck(TextBox1.Text, 1, 30)
    If numbercheck(TextBox1.Text, 1, 30) = True Then
    l = TextBox1.Text
    Else : MsgBox("Enter a number between 1 and 30 in the Length box") : TextBox1.Text = ""
    End If
    
    Call numbercheck(TextBox2.Text, 1, 20)
    If numbercheck(TextBox2.Text, 1, 20) = True Then
    w = TextBox2.Text
    Else : MsgBox("Enter a number between 1 and 20 in the Width box") : TextBox2.Text = ""
    End If
    
    If w > l Then MsgBox("Make Length greater than Width") : TextBox1.Text = "" : TextBox2.Text = ""
    
    
    
    
    
    'rolls'
    r = (w / 5)
    rr = Math.Ceiling(w / 5)
    TextBox4.Text = r
    
    
    'total length'
    tl = (r * l)
    TextBox3.Text = tl
    
    'excess carpet'
    x = (rr * 30) - tl
    TextBox5.Text = x
    
    TextBox3.Text = tl
    TextBox4.Text = r
    TextBox5.Text = x
    
    
    End Sub
    Function numbercheck(ByVal value, ByVal min, ByVal max)
    If IsNumeric(value) = True Then
    numbercheck = True
    If value > max Then numbercheck = False
    If value < min Then numbercheck = False
    Else : numbercheck = False
    End If
    
    End Function
    
    Private Sub ClearButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ClearButton.Click
    TextBox1.Text = ""
    TextBox2.Text = ""
    TextBox3.Text = ""
    TextBox4.Text = ""
    TextBox5.Text = ""
    End Sub
    End Class
    Last edited by ilvbvm; Oct 29th, 2009 at 02:23 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width