在Visual Basic中验证文本框 [英] Validating Text box in Visual Basic

查看:138
本文介绍了在Visual Basic中验证文本框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,我的表单上有文本框,详细信息如下:


因此,我想知道,如何也不要在文本框中保存此借口?我的意思是,如果用户未在文本框中键入任何内容,则只能保存空白字段,并且不得保存其借口.

Hello, I have textbox on my form, the details are below:


So, I want to know, how to NOT save this pretext on the textbox also? I mean only blank field and the pretext must not be saved if the user has not typed anything on the textbox.

推荐答案

为什么不只是测试文本框是否包含预定义的文本,例如:
Why not just test if the text box contains the predefined text, something like:
If textbox.text = "" Or textbox.text = "Insert username here" Then
MsgBox ("Fill the username field please")
Else
Etc....


这篇关于在Visual Basic中验证文本框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆