检查空文本框 [英] Checking Empty textbox
本文介绍了检查空文本框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
好的我有6个文本框,用户需要填写每个文本框。所以我想做一个检查,以确保没有留空,但我有一点麻烦。
i尝试做
Ok i have 6 textboxes, and the user is required to fill in each of them. so i want to do a check to make sure none are left blank, but im having a little trouble.
i tried doing
展开 | 选择 | Wrap | 行号
推荐答案
快速而肮脏:
quick and dirty:
展开 | 选择 | < span class =codeLinkonclick =WordWrap(this);> Wrap | 行号
又快又脏:
如果txtChoice1.text =""然后
MsgBox(你错过了一个偏好。)
elseIf txtChoice2.text =""然后
MsgBox(你错过了一个偏好。)
elseIf txtChoice3.text =""然后
MsgBox(你错过了一个偏好。)
结束如果
使else一个字。
如果您使用的是VB6,请查看使用文本框数组来简化这一过程。
quick and dirty:
If txtChoice1.text = "" Then
MsgBox ("You have missed out a preference.")
elseIf txtChoice2.text = "" Then
MsgBox ("You have missed out a preference.")
elseIf txtChoice3.text = "" Then
MsgBox ("You have missed out a preference.")
end if
make elseif one word.
if you''re using VB6, look into using arrays of textboxes to make this easier.
它仍然没有奏效。即使我填写所有文本框 - 我仍然收到消息。
it still never worked. even though i fill in all the textboxes - i still get the message.
它仍然没有工作。即使我填写所有文本框 - 我仍然得到消息。
it still never worked. even though i fill in all the textboxes - i still get the message.
试试这个:
Try this:
展开 | 选择 | Wrap < span class =codeDivider> | 行号
这篇关于检查空文本框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文