Results 1 to 10 of 10

Thread: "Negative" Probelm...

Threaded View

  1. #2
    Frenzied Member cssriraman's Avatar
    Join Date
    Jun 2005
    Posts
    1,465

    Re: "Negative" Probelm...

    Don't allow the user to enter negative numbers. Check the number before you calculate whether it is negative, if negative notify the user saying "Negative number is not allowed. Enter the positive number". Like
    vb Code:
    1. Option Explicit
    2.  
    3. Sub main()
    4.     Dim I As Integer
    5.     I = InputBox("Enter the number:")
    6.     If I < 0 Then
    7.         Call MsgBox("The number you entered is negative. Please enter the positive numbers.", vbExclamation, App.Title)
    8.     Else
    9.         '... Your Calculations
    10.     End If
    11. End Sub
    Last edited by cssriraman; Apr 8th, 2007 at 10:54 PM.
    CS

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