VB textbox编辑
来源:百度知道 编辑:UC知道 时间:2024/09/22 10:33:27
想实现的是,textbox里面如果有数据的话禁止编辑,如果没有数据是空的话允许编辑。
谢谢各位,有分有分一定有分,我先试试那个比较好成不成啊,不给分太不厚道,不能干那事儿
谢谢各位,有分有分一定有分,我先试试那个比较好成不成啊,不给分太不厚道,不能干那事儿
用IF语句实现,代码如下:
if text1.text<>"" then
text1.enabled=false
else
text1.enabled=true
end if
不会没分吧?
在form_onload方法里添加代码
if me.textbox.text = "" then
me.textbox.readonly = false
else
me.textbox.readonly = true
endif
private sub text1_change()
if text1.text ="" then text1.locked =false else text1.locded =true
end sub
if me.textbox.text = "" then
me.textbox.readonly = false
else
me.textbox.readonly = true
'如果背景色还是要白色
Me.TextBox1.BackColor = SystemColors.Window
endif
不会这么简单吧?HOHO