VB编程循环语句问题
2个回答
展开全部
Private Sub TextBox1_KeyPress(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress
If e.KeyChar = Chr(13) Then
Dim str = TextBox1.Text
If Not IsNumeric(str) OrElse Val(str) <= 0 Then
MessageBox.Show("不是正整数", "Message", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
TextBox1.SelectAll()
Else
Dim jishu As Integer
For i = 1 To str.Length
Dim shuzi = Mid(str, i, 1)
If Val(shuzi) Mod 2 = 1 Then
jishu += 1
End If
Next
TextBox2.Text = jishu
End If
End If
End Sub
怎么全在问这个问题,你们是一伙的把,我要举报你们
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询