VB中如何判断text1.text里是否输入的是汉字,或字母,数字.
2个回答
展开全部
在窗体加一个按钮 command1
private sub command1_click()
dim s as string,i as integer , alph as boolean
s=ucase(text1)
for i=1 to len(s)
if mid(s,i,1)<="A" or mid("s",i,1)>="Z" then
alph=true
exit for
end if
next
if alph=false then
msgbox "文本框全为字母"
else
msgbox "文本框不全为字母"
end if
end sub
private sub command1_click()
dim s as string,i as integer , alph as boolean
s=ucase(text1)
for i=1 to len(s)
if mid(s,i,1)<="A" or mid("s",i,1)>="Z" then
alph=true
exit for
end if
next
if alph=false then
msgbox "文本框全为字母"
else
msgbox "文本框不全为字母"
end if
end sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询