so now my code look like this but it still has the same problem . the 9th digit i entered still saves inside num8. so i tried checking the value of "Len(lngNumber)" by using "Label41.Caption" and found out that the value is always 4 .

VB Code:
  1. Private Sub Text1_Keypress(Keyascii As Integer)
  2.  
  3. Dim num1 As Integer
  4. Dim num2 As Integer
  5. Dim num3 As Integer
  6. Dim num4 As Integer
  7. Dim num5 As Integer
  8. Dim num6 As Integer
  9. Dim num7 As Integer
  10. Dim num8 As Integer
  11. Dim lngNumber As Long
  12.    
  13.     Select Case Keyascii
  14.         Case vbKey0 To vbKey9, vbKeyBack
  15.             'do nothing, accept the keys
  16.         Case Else
  17.             Beep 'optional
  18.             Keyascii = 0
  19.     End Select
  20.      
  21.  
  22.  
  23.     ' convert string to Long variable
  24.     lngNumber = CLng(Val(Text1.Text & (Chr(Keyascii))))
  25.    
  26.  
  27.      ' to multiple variables
  28.     num1 = lngNumber \ 10000000
  29.     num2 = (lngNumber \ 1000000) Mod 10
  30.     num3 = (lngNumber \ 100000) Mod 10
  31.     num4 = (lngNumber \ 10000) Mod 10
  32.     num5 = (lngNumber \ 1000) Mod 10
  33.     num6 = (lngNumber \ 100) Mod 10
  34.     num7 = (lngNumber \ 10) Mod 10
  35.     num8 = lngNumber Mod 10
  36.    
  37.     If Len(lngNumber) > 8 Then
  38.     Keyascii = 0 'put nothing
  39.     Exit Sub ' skip the rest
  40.     End If
  41.        
  42. 'this is to check the num's value
  43.  
  44. Label41.Caption = Len(lngNumber)
  45. Label42.Caption = num2
  46. Label43.Caption = num3
  47. Label44.Caption = num4
  48. Label13.Caption = num5
  49. Label12.Caption = num6
  50. Label24.Caption = num7
  51. Label25.Caption = num8
  52.  
  53.  
  54.  
  55. End Sub