亲爱的我的子
Dim onThisTable as String ="Name" Private Sub skill_mouseHover(ByVal sender As System.Object,ByVal e As System.EventArgs) Handles button1.MouseHover,button2.MouseHover,panel1.MouseHover,panel2.MouseHover,pBox1.MouseHover descriptionLabel.Text = dbClass.getDescription(sender.Text,onThisTable) End Sub
现在,我希望根据用户传递的内容(面板或一个pBox或一个按钮)给onThisTable一个不同的值,但是我无法找到什么是正确的方式来比较它是什么类型的?
Private Sub skill_mouseHover(ByVal sender As System.Object,pBox1.MouseHover if sender is ( a button ) onThisTable = "Admin" else if sender is ( a panel ) onThisTable = "dbObject" else onThisTable ="Name" end if descriptionLabel.Text = dbClass.getDescription(sender.Text,onThisTable) End Sub
您可以在此处使用TypeOf关键字作为描述(
link)
If TypeOf sender Is Button Then onThisTable = "Admin" ElseIf TypeOf sender Is System.Windows.Forms.Panel Then onThisTable = "dbObject" Else onThisTable = "Name" End If
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。