VB6.0用掲示板の過去のログ(No.1)−VBレスキュー(花ちゃん)
[記事リスト] [新規投稿] [新着記事] [ワード検索] [過去ログ] [管理用]

投稿日: 2003/08/18(Mon) 22:09
投稿者たけちゃん
Eメール
URL
タイトル計算結果がなぜか0になる??

こんばんは、先日はありがとうございました。
この度、自分で試しにコーディングしたのですが、どうしても
計算結果が0になりますが、どうしてですか?
データ型宣言がおかしいのですか?
少し長いですが、下記にコーディングを書いておきます。
Private Sub Command1_Click()
Dim u As Double
    u = s + t
    Debug.Print u
End Sub

Private Sub Text1_Change()
    If Len(Text1.Text) >= 3 Then
        Text2.SetFocus
    End If
End Sub
Private Sub Text2_KeyPress(KeyAscii As Integer)
Dim s As Double
    If KeyAscii = vbKeyReturn Then
        KeyAscii = 0
        s = Val(Text1.Text & "." & Text2.Text)
        Debug.Print s
        Text3.SetFocus
    End If
End Sub
Private Sub Text3_Change()
    If Len(Text3.Text) >= 2 Then
        Text4.SetFocus
    End If
End Sub
Private Sub Text4_KeyPress(KeyAscii As Integer)
Dim t As Double
    If KeyAscii = vbKeyReturn Then
        KeyAscii = 0
        t = Val(Text3.Text & "." & Text4.Text)
        Debug.Print t
        Command1.SetFocus
    End If
End Sub


- 関連一覧ツリー (★ をクリックするとツリー全体を一括表示します)

- 返信フォーム (この記事に返信する場合は下記フォームから投稿して下さい)

- Web Forum -