检查是否单击了按钮?谁可以帮助纠正命令? [英] Check if button is clicked? Who can help correct command?

查看:54
本文介绍了检查是否单击了按钮?谁可以帮助纠正命令?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果form2.button1.clicked那么

me.hide()

else

form3.showdialog()

结束如果



我尝试过:



我不知道任何代码。请帮助我!

If form2.button1.clicked then
me.hide()
else
form3.showdialog()
end if

What I have tried:

I do not know any code for this. Please help me!

推荐答案

它不能那样工作:你表示什么是假设的布尔属性点击类按钮(我假设你的意思是System.Windows.Forms.Button)以事件的形式存在,名为点击。事件不像理论代码示例中的字段或属性那样被读取。他们正在订阅,当他们解雇订阅他们的方法(事件处理程序)时。



尝试这个:

- 打开或创建一个带有表单的项目。

- 在设计器中打开表单并在其上放一个按钮。

- 双击按钮。 Visual Studio会自动创建方法存根(如果不重命名按钮,则命名为Button1_Click)将其添加到该按钮的Click事件的订阅者列表中。只要单击该按钮,就会调用该方法。

- 编写单击按钮进入该方法时应执行的代码。



我强烈建议你找一些书和/或好的在线教程。你显然是一名初学者,在这一点上,你将从一本书或类似的书中学到更快更全面的知识,而不是在论坛上提问。
It doesn't work like that: What you denote as a hypothetical boolean property "clicked" of the class Button (I assume you mean System.Windows.Forms.Button) exists in form of an event named Click. Events aren't being read like a field or a property like in your theoretical code sample. They're being subscribed to and when they "fire" the method(s) that are subscribed to them ("event-handlers") are being called.

Try this:
- Open or create a project with a form.
- Open the form in the designer and place a button onto it.
- Double-click the button. Visual Studio automatically creates a method-stub (named "Button1_Click" if you didn't rename the button) and adds it to the subscriber-list of the Click-event of that button. Whenever the button is clicked that method will be called.
- Write the code that should be executed when the button is clicked into that method.

I strongly recommend you to find some books and/or good online tutorials. You're obviously a beginner and at that point you will learn faster and more thoroughly from a book or similar than asking in forums.


这篇关于检查是否单击了按钮?谁可以帮助纠正命令?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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