复选框代码 [英] Check box codes
本文介绍了复选框代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在visual basic中编写代码,允许用户选择显示或隐藏标签而不使用if语句?
解决方案
我写了chkTitle.Value = 1
lblTitle.Caption =""
现在当它处于运行模式时,当我勾选方框时lblTitle.Caption随着我的意愿消失了
但是我应该写什么,以便当我取消选中它(chk.Title.Value = 0)时,我的lblTitle.Caption =无论它是什么。 ..?
i试图在lblTitle.Caption ="下写chkTitle.Value = 0 rigth "但它不起作用..说运行时错误28
任何人都可以帮助我吗?
嗯...别以为我没有注意到它的重新发布题。 :(
但是,既然你似乎正在努力自己做这项工作,这里有一个建议......尝试改变可见性,而不是文字。
嗯...别以为我没有注意到重新发布同一个问题。:(
但是,既然你似乎在努力自己做这项工作,这里有一个建议......尝试改变可见度,而不是文字。
hm ..好吧所以
chkTitle.Value = 1
lblTitle.Visible = False
这个有效但是我的问题是,一旦我检查它并且标题消失,我就不能取消选中它...我不知道我应该如何将两个代码放在一起...尝试用
chkTitle.Value = 1
lblTitle.Visible = False
chkTitle.Value = 0
lblTitle.Visible = True
但不起作用..谢谢 求助:)
How do i write codes in visual basic for check boxes that allow the user to choose to display or hide the the lables without using the if statement?
解决方案
I wrote chkTitle.Value = 1
lblTitle.Caption = ""
and now when it is in the Run mode, when I check the box the lblTitle.Caption disappears as I wish
but what should i write so that when i uncheck it (chk.Title.Value = 0) , my lblTitle.Caption = whatever it was...?
i tried to write chkTitle.Value = 0 rigth under lblTitle.Caption = " " but it doesnt work .. says run time error "28"
can anyone help me?
Hm... don''t think I didn''t notice the re-posting of the same question. :(
However, since you seem to be making an effort at doing the work yourself, here''s a suggestion... try changing the visibility, rather than the text.
Hm... don''t think I didn''t notice the re-posting of the same question. :(
However, since you seem to be making an effort at doing the work yourself, here''s a suggestion... try changing the visibility, rather than the text.
hm.. okay so
chkTitle.Value = 1
lblTitle.Visible = False
this works too but My problem is that once i checked it and the Title dissapears I cannot uncheck it... and I dont know how should I put both code together... tried with
chkTitle.Value = 1
lblTitle.Visible = False
chkTitle.Value = 0
lblTitle.Visible = True
but doesnt work..Thanks for the help :)
这篇关于复选框代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文