vb简单问题 求大神们帮帮忙
要做一个Keypress,文本框显示该键的ASCII码值PublicClassForm1PrivateSubTextBox1_KeyPress(senderAsObjec...
要做一个Keypress, 文本框显示该键的ASCII码值
Public Class Form1
Private Sub TextBox1_KeyPress(sender As Object, e As KeyPressEventArgs) Handles TextBox1.KeyPress
End Sub
Private Sub TextBox1_KeyPress(KeyAscii As Integer)
TextBox1.Text = "的ASCII为" & KeyAscii
End Sub
Private Sub TextBox1_TextChanged(sender As Object, e As EventArgs) Handles TextBox1.TextChanged
End Sub
End Class
我用vs2012做的 不知道怎么做 求大神指点一下 展开
Public Class Form1
Private Sub TextBox1_KeyPress(sender As Object, e As KeyPressEventArgs) Handles TextBox1.KeyPress
End Sub
Private Sub TextBox1_KeyPress(KeyAscii As Integer)
TextBox1.Text = "的ASCII为" & KeyAscii
End Sub
Private Sub TextBox1_TextChanged(sender As Object, e As EventArgs) Handles TextBox1.TextChanged
End Sub
End Class
我用vs2012做的 不知道怎么做 求大神指点一下 展开
2个回答
展开全部
Public KeyAscii As Integer
Private Sub TextBox1_KeyPress(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress
KeyAscii = Asc(e.KeyChar)
End Sub
Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
TextBox1.Text = "的ASCII为" & KeyAscii
End Sub
VB.NET和VB6.0不一样,KeyPress获取到的是字符型,需要用Asc转换
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询