www.pudn.com > vbnumkey.rar > FrmNumber.frm, change:2013-02-21,size:9900b


VERSION 5.00 
Begin VB.Form FrmNumber  
   ClientHeight    =   4890 
   ClientLeft      =   4560 
   ClientTop       =   1695 
   ClientWidth     =   4785 
   ControlBox      =   0   'False 
   LinkTopic       =   "Form2" 
   MaxButton       =   0   'False 
   MinButton       =   0   'False 
   ScaleHeight     =   4890 
   ScaleWidth      =   4785 
   Begin VB.CommandButton Command1  
      Caption         =   "." 
      BeginProperty Font  
         Name            =   "宋体" 
         Size            =   15.75 
         Charset         =   134 
         Weight          =   400 
         Underline       =   0   'False 
         Italic          =   0   'False 
         Strikethrough   =   0   'False 
      EndProperty 
      Height          =   735 
      Index           =   10 
      Left            =   1200 
      TabIndex        =   10 
      Top             =   3840 
      Width           =   975 
   End 
   Begin VB.CommandButton Command1  
      Caption         =   "0" 
      BeginProperty Font  
         Name            =   "宋体" 
         Size            =   15.75 
         Charset         =   134 
         Weight          =   400 
         Underline       =   0   'False 
         Italic          =   0   'False 
         Strikethrough   =   0   'False 
      EndProperty 
      Height          =   735 
      Index           =   0 
      Left            =   240 
      TabIndex        =   0 
      Top             =   3840 
      Width           =   975 
   End 
   Begin VB.CommandButton Command1  
      Caption         =   "OK" 
      Height          =   735 
      Index           =   11 
      Left            =   3480 
      TabIndex        =   11 
      Top             =   3840 
      Width           =   975 
   End 
   Begin VB.CommandButton Command1  
      Caption         =   "Cancel" 
      Height          =   735 
      Index           =   12 
      Left            =   3480 
      TabIndex        =   13 
      Top             =   3120 
      Width           =   975 
   End 
   Begin VB.CommandButton Command1  
      Caption         =   "Cls" 
      Height          =   735 
      Index           =   13 
      Left            =   3480 
      TabIndex        =   14 
      Top             =   2400 
      Width           =   975 
   End 
   Begin VB.TextBox Text1  
      Enabled         =   0   'False 
      BeginProperty Font  
         Name            =   "宋体" 
         Size            =   21.75 
         Charset         =   134 
         Weight          =   400 
         Underline       =   0   'False 
         Italic          =   0   'False 
         Strikethrough   =   0   'False 
      EndProperty 
      Height          =   495 
      Left            =   1200 
      TabIndex        =   12 
      Top             =   960 
      Width           =   1455 
   End 
   Begin VB.CommandButton Command1  
      Caption         =   "9" 
      BeginProperty Font  
         Name            =   "宋体" 
         Size            =   15.75 
         Charset         =   134 
         Weight          =   400 
         Underline       =   0   'False 
         Italic          =   0   'False 
         Strikethrough   =   0   'False 
      EndProperty 
      Height          =   735 
      Index           =   9 
      Left            =   2160 
      TabIndex        =   9 
      Top             =   3120 
      Width           =   975 
   End 
   Begin VB.CommandButton Command1  
      Caption         =   "8" 
      BeginProperty Font  
         Name            =   "宋体" 
         Size            =   15.75 
         Charset         =   134 
         Weight          =   400 
         Underline       =   0   'False 
         Italic          =   0   'False 
         Strikethrough   =   0   'False 
      EndProperty 
      Height          =   735 
      Index           =   8 
      Left            =   1200 
      TabIndex        =   8 
      Top             =   3120 
      Width           =   975 
   End 
   Begin VB.CommandButton Command1  
      Caption         =   "7" 
      BeginProperty Font  
         Name            =   "宋体" 
         Size            =   15.75 
         Charset         =   134 
         Weight          =   400 
         Underline       =   0   'False 
         Italic          =   0   'False 
         Strikethrough   =   0   'False 
      EndProperty 
      Height          =   735 
      Index           =   7 
      Left            =   240 
      TabIndex        =   7 
      Top             =   3120 
      Width           =   975 
   End 
   Begin VB.CommandButton Command1  
      Caption         =   "6" 
      BeginProperty Font  
         Name            =   "宋体" 
         Size            =   15.75 
         Charset         =   134 
         Weight          =   400 
         Underline       =   0   'False 
         Italic          =   0   'False 
         Strikethrough   =   0   'False 
      EndProperty 
      Height          =   735 
      Index           =   6 
      Left            =   2160 
      TabIndex        =   6 
      Top             =   2400 
      Width           =   975 
   End 
   Begin VB.CommandButton Command1  
      Caption         =   "5" 
      BeginProperty Font  
         Name            =   "宋体" 
         Size            =   15.75 
         Charset         =   134 
         Weight          =   400 
         Underline       =   0   'False 
         Italic          =   0   'False 
         Strikethrough   =   0   'False 
      EndProperty 
      Height          =   735 
      Index           =   5 
      Left            =   1200 
      TabIndex        =   5 
      Top             =   2400 
      Width           =   975 
   End 
   Begin VB.CommandButton Command1  
      Caption         =   "4" 
      BeginProperty Font  
         Name            =   "宋体" 
         Size            =   15.75 
         Charset         =   134 
         Weight          =   400 
         Underline       =   0   'False 
         Italic          =   0   'False 
         Strikethrough   =   0   'False 
      EndProperty 
      Height          =   735 
      Index           =   4 
      Left            =   240 
      TabIndex        =   4 
      Top             =   2400 
      Width           =   975 
   End 
   Begin VB.CommandButton Command1  
      Caption         =   "3" 
      BeginProperty Font  
         Name            =   "宋体" 
         Size            =   15.75 
         Charset         =   134 
         Weight          =   400 
         Underline       =   0   'False 
         Italic          =   0   'False 
         Strikethrough   =   0   'False 
      EndProperty 
      Height          =   735 
      Index           =   3 
      Left            =   2160 
      TabIndex        =   3 
      Top             =   1680 
      Width           =   975 
   End 
   Begin VB.CommandButton Command1  
      Caption         =   "2" 
      BeginProperty Font  
         Name            =   "宋体" 
         Size            =   15.75 
         Charset         =   134 
         Weight          =   400 
         Underline       =   0   'False 
         Italic          =   0   'False 
         Strikethrough   =   0   'False 
      EndProperty 
      Height          =   735 
      Index           =   2 
      Left            =   1200 
      TabIndex        =   2 
      Top             =   1680 
      Width           =   975 
   End 
   Begin VB.CommandButton Command1  
      Caption         =   "1" 
      BeginProperty Font  
         Name            =   "宋体" 
         Size            =   15.75 
         Charset         =   134 
         Weight          =   400 
         Underline       =   0   'False 
         Italic          =   0   'False 
         Strikethrough   =   0   'False 
      EndProperty 
      Height          =   735 
      Index           =   1 
      Left            =   240 
      TabIndex        =   1 
      Top             =   1680 
      Width           =   975 
   End 
   Begin VB.CommandButton Command1  
      Caption         =   "Back" 
      Height          =   735 
      Index           =   14 
      Left            =   3480 
      TabIndex        =   15 
      Top             =   1680 
      Width           =   975 
   End 
   Begin VB.Label Label1  
      Caption         =   "数字键盘" 
      BeginProperty Font  
         Name            =   "宋体" 
         Size            =   26.25 
         Charset         =   134 
         Weight          =   400 
         Underline       =   0   'False 
         Italic          =   0   'False 
         Strikethrough   =   0   'False 
      EndProperty 
      Height          =   495 
      Left            =   1200 
      TabIndex        =   16 
      Top             =   120 
      Width           =   2175 
   End 
End 
Attribute VB_Name = "FrmNumber" 
Attribute VB_GlobalNameSpace = False 
Attribute VB_Creatable = False 
Attribute VB_PredeclaredId = True 
Attribute VB_Exposed = False 
Private Sub Command1_Click(Index As Integer) 
'数字键盘,单击按键子过程 
Select Case Index 
  Case 0 To 9   '0~9数字键 
    If Text1.Text <> "0" Then       '首字符不是0就直接输入,首字符是0无响应 
     
      Text1.Text = Text1.Text & Index 
    End If 
  Case 10       '小数点 
    If Text1.Text <> "" Then 
      Text1.Text = Text1.Text & "."       '如果文本框为空则不响应,不为空则输入 
    End If 
  Case 11       'OK键 
    If Text1.Text = "" Then       '如果文本框为空,则返回0,如果不这空则返回输入值 
      Frmname.ActiveControl.Text = 0 
    Else 
      Frmname.ActiveControl.Text = Text1.Text 
       
    End If 
    Unload FrmNumber 
  Case 12       'Cancel键,直接关闭键盘窗口 
    Unload FrmNumber 
  Case 13       'CLS键,清空文本框 
    Text1.Text = "" 
  Case 14       'backspace退格键 
    If Text1.Text <> "" Then 
      Text1.Text = Left(Text1.Text, Len(Text1.Text) - 1)    '去掉最右边字符,若文本框空则不响应 
    End If 
End Select 
 
End Sub