Form1隐藏条件复选框选中true [英] Form1 hide with condition checked box checked true

查看:67
本文介绍了Form1隐藏条件复选框选中true的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在复选框检查为true时尝试了此代码,然后运行,否则没有,但它正常工作不适用于此条件:



我有什么试过:



 受保护 覆盖  Sub  OnLoad( ByVal  e 作为 EventArgs)' 此代码只是表单 
可见= False
ShowInTaskbar = False
Opacity = 0
MyBase .OnLoad(e)
结束 Sub

解决方案

目前还不是很清楚你想要什么,但是我认为你需要使用 CheckBox .CheckedChanged 事件:

CheckBox.CheckedChanged Event(System.Windows.Forms)| Microsoft Docs [ ^ ]



另见这里的示例: Visual Basic 2017第21课:使用复选框 - Visual Basic [ ^ ]


<帮助你自己帮忙:你现在已经提出了100多个问题 - 包括我今天早些时候就怀疑这个问题 - 但你似乎不知道如何以可以回答的形式提出问题。



您显示的代码没有复选框,也不能涉及一个 - 它是表单的Load事件,它在表单显示之前就已经发生了,而且很好确实在用户可以访问任何GUI组件之前像复选框一样的ents。因此,如果用户无法访问该复选框,您为什么还要考虑查看他选择的内容?



坦率地说,它看起来像一个(很差) )尝试隐藏应用程序,以便用户不知道其运行;看起来像恶意代码 - 但是你不会写那个,不是吗?



想想你之前的大量问题,以及快速得到好答案的问题。他们为什么工作,尽可能少打字不?问一个好问题是一种技巧,而你似乎并没有发展:相反,你似乎成了一个帮助吸血鬼......


I tried this code when check box checked true then it runs otherwise not, but it is working normally not apply conditions here:

What I have tried:

Protected Overrides Sub OnLoad(ByVal e As EventArgs)   'by this code just Form  form 
    Visible = False
    ShowInTaskbar = False
    Opacity = 0
    MyBase.OnLoad(e)
End Sub

解决方案

It is not very clear what you want, but I think you need to use the CheckBox.CheckedChanged Event:
CheckBox.CheckedChanged Event (System.Windows.Forms) | Microsoft Docs[^]

Also see examples here: Visual Basic 2017 Lesson 21: Working with Checkboxes - Visual Basic[^]


Do yourself a favour: you have asked over 100 questions here now - including I suspect this very one earlier today - but you seem to have no idea how to ask a question in a form that can be answered.

The code you show doesn't have a checkbox, and can't involve one - it's the Load event for a Form which occurs well before the form can be displayed, and so well and truly before the user can access any GUI components like a checkbox. So if the user can't access the checkbox, why are you even thinking of checking to see what he selected?

And frankly, it looks like a (very poor) attempt to hide an app so the user doesn't know its running; which looks like malicious code - but you wouldn't write that, would you?

Think about your enormous pile of previous questions, and the ones that got good answers quickly. Why did they work, and the "type as little as possible" ones not? Ask ing a good question is a skill, and one you do not seem to be developing: instead you seem to be becoming a Help Vampire ...


这篇关于Form1隐藏条件复选框选中true的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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