本文介绍了相同的子,多个控件点击事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想让菜单项成为一个主菜单栏,代表本周的日子

。当您点击它们时,它们会从已选中交替显示为

未选中。现在我有7个看起来像这个的子站点:


Private Sub SunMenuItem_Click(ByVal sender As System.Object,ByVal e As

System.EventArgs)处理SunMenuItem.Click

如果SunMenuItem.Checked则

SunMenuItem.Checked = False

否则

SunMenuItem.Checked = True

结束如果

结束子


我想使用相同的子句来处理所有7个菜单项。我怎么会写这个呢?

I would like to have menu items a main menu bar that represent the days
of the week. When you click on them they alternate from checked to
unchecked. Right now I have 7 subs that look like this one:

Private Sub SunMenuItem_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles SunMenuItem.Click
If SunMenuItem.Checked Then
SunMenuItem.Checked = False
Else
SunMenuItem.Checked = True
End If
End Sub

I would like to use the same sub to handle all 7 menu items. How would
I write this?

推荐答案







这篇关于相同的子,多个控件点击事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-23 20:38