关于text里面的值改变的问题!
我做一个程序,有一个文本框,在里面输入不同的数据,另外两个文本框要相应的改变数据。请问 我该怎么做。文本框改变时 加入代码是不行的。。
[解决办法]
其实你text19_keypress过程中不用去那一句也可以,你只需要把一些代码放到change就可以了
Private Sub Text19_Change()
If Text19.text = 0.3 Then
Text2.text = 143.37
Text3.text = 143.37
r = 2133.7
ElseIf Text19.text = 0.25 Then
Text2.text = 138.8
Text3.text = 138.8
r = 2147.8
End If
End Sub
另外,keypress事件为了判别是否有两个“.”加入一行代码即可,改动如下:
Private Sub Text19_KeyPress(KeyAscii As Integer)
Dim s, ss,sss As String
Select Case KeyAscii
Case 48 To 57, 46, 8
s = Right$(Text19.Text, 3)
ss = Left$(s, 1)
sss = Right$(s, 1)
If KeyAscii = 46 Then
If sss = ". " Then
KeyAscii = 0
End If
End If
If ss = ". " Then
If KeyAscii <> 8 Then
KeyAscii = 0
End If
End If
Case Else: KeyAscii = 0
End Select
End Sub
关于text里面的值改变的有关问题
关于text里面的值改变的问题!我做一个程序,有一个文本框,在里面输入不同的数据,另外两个文本框要相应的改
