Results 1 to 11 of 11

Thread: Validation TextBox in Loop (Collection) ? A still no solved

Threaded View

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2005
    Location
    in Poland
    Posts
    390

    Validation TextBox in Loop (Collection) ? A still no solved

    Hi
    Again, the same problem, a still no solved.
    Already I have the procedure however I will want to use to all TextBoxes
    in my app using to this collection.

    Code:
    Option Explicit
    
    Private Sub Text1_KeyPress(Index As Integer, KeyAscii As Integer)
    
    
        
    
           Text1(Index).MaxLength = 5   '<<< it specifies the amount of signs
    
    
             If KeyAscii = 13 Then      '<<< exceptionally do it permit for Enter key
                SendKeys "{tab}"
                KeyAscii = 0
          
             ElseIf KeyAscii <> 8 Then  '<<< or for BackSpace key
    
              '<<< if is comma
              '<<< then block for next the comma and other non-numeric signs
      
                If InStr(1, Text1(Index), ",") And KeyAscii = 44 Then KeyAscii = 0
                  If Not IsNumeric(Chr$(KeyAscii)) And KeyAscii <> 44 Then
                     MsgBox "ONLY numbers", vbCritical + vbOKOnly, "Attention !"
                     KeyAscii = 0
                  End If
             End If
    
              '<<< however when first the sign it's comma then add sign an zero
     
               If Mid$(Text1(Index), 1, 1) = "," Then
                 Text1(Index).Text = "0" & Text1(Index).Text
                 Text1(Index).SelStart = Len(Text1(Index))
               End If
    This code working fine but... for the array controls

    Thanks in advance

    BTW: how to protect before use of pasted value - I think there is no sense to prevent an pasting this. Rather necessary it will be a some the procedure to checking the values. How to make?
    Last edited by Tamgovb; Jun 1st, 2007 at 10:17 AM.
    I know, I know, my English is bad, sorry .....

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