⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 2500.html

📁 VB技巧问答10000例 VB技巧问答10000例
💻 HTML
字号:
<html>
  <head>
    <title>Can anyone help me to find what is going wrong?</title>
  </head>
  <BODY BACKGROUND="" BGCOLOR="white" TEXT="black" LINK="red" VLINK="#808080" ALINK="">
    <center>
      <h1>Can anyone help me to find what is going wrong?</h1>
    </center>

<HR><p>
Posted by <a href="mailto:rice41@technologist.com">Rice41</a> on April 05, 1998 at 04:27:20:<p>
Dear all,<br>I wrote a text box to get the string, but it goes strange because if I type<br>in "12345" the debug.print shows I only input "1234" which the last charater is mmissed<br>Can anyone tell me what wrong with my code. Thanks<p><br>Private Sub Text2_KeyPress(KeyAscii As Integer)<br>    Dim n As Single<br>    Dim m As Integer<br>    CheckString KeyAscii<br>    Select Case KeyAscii<br>        Case Is = 107 Or 75<br>            SendKeys "{tab}"<br>            n = CSng(Val(Text2))<br>            n = n * 1000<br>        Case Is = 109<br>            SendKeys "{tab}"<br>            n = CSng(Val(Text2))<br>            n = n / 1000<br>        Case Is = 77<br>            SendKeys "{tab}"<br>            n = CSng(Val(Text2))<br>            n = n * 1000000<br>        Case Is = 45<br>            m = Len(Text2)<br>            If m > 1 Then<br>                MsgBox "Invalid input, please submit again"<br>            End If<br>            n = CSng(Val(Text2))<br>        Case Else<br>            n = CSng(Val(Text2))<br>    End Select<br>End Sub<p><br> Function CheckString(X As Integer) As Integer<br>    Dim strValid As String<br>    <br>    strValid = "0123456789.-kKnNmM"<br>    If X > 44 And X < 127 Then<br>        If InStr(strValid, Chr(X)) = 0 Then<br>            X = 0<br>        End If<br>    Else<br>        X = 0<br>    End If<br>End Function
<br>
<p>
<a name="followups">Follow Ups:</a><br>
<ul><!--insert: 2500-->
<!--top: 2508--><li><a href="2508.html"><b>KeyPress 事件本来就就这样</b></a> 小吴 <i>19:30:11 4/05/98</i>
(<!--responses: 2508-->0)
<ul><!--insert: 2508-->
</ul><!--end: 2508-->
</ul><!--end: 2500-->
<br><HR><p>

</body></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -