Results 1 to 2 of 2

Thread: How do you limit the numbers?

  1. #1

    Thread Starter
    Member
    Join Date
    Oct 1999
    Posts
    33
    I have a text box. I want it where an user cannot enter
    in a number over "5,000" Thanks

    -Matthew

  2. #2
    Addicted Member
    Join Date
    Aug 1999
    Location
    Ottawa,ON,Canada
    Posts
    217
    How about this:
    Code:
    Private Sub Text1_Change()
       Static stsPrevValue As String
       
       If Text1.Text <> vbNullString Then
          If IsNumeric(Text1.Text) = False Then
             Text1.Text = stsPrevValue
          ElseIf CDbl(Text1.Text) > 5000 Then
             Text1.Text = stsPrevValue
          Else
             stsPrevValue = Text1.Text
          End If
       End If
    End Sub
    Just off the top of my head.
    Dan PM
    Analyst Programmer

    VB6 SP3 (also VB4 16-bit sometimes )

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