Results 1 to 2 of 2

Thread: ActiveX - Urgent

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2000
    Posts
    11

    Unhappy

    Can anyone please help me with this question?

    How to create an ActiveX control which allows the user to input values between 1 to 100 inclusive?

    Thanks!

  2. #2
    Frenzied Member
    Join Date
    Mar 2000
    Posts
    1,089
    I don't know if I'd even bother with an activeX control for that, just use a text box and add this code

    Code:
    Option Explicit
    
    Private Sub Form_Load()
    Text1.Text = 0
    End Sub
    
    Private Sub Text1_Change()
    Static strOldText As String
    
    On Error GoTo ERR_NOTNUMBER:
    
    If Text1.Text = "" Then Text1.Text = 0
    If CByte(Text1.Text) > 100 Then Err.Raise 1
    
    strOldText = Text1.Text
    
    Exit Sub
    
    ERR_NOTNUMBER:
    
    Text1.Text = strOldText
    Text1.SelStart = Len(Text1.Text)
    
    End Sub
    modify it to your needs

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