类中的VB.Net代码和WithEvents问题

时间:2016-10-01 23:06:40

标签: vb.net class

我创建了一个VB.Net应用程序,它由一个表单和一系列类组成。一个类(GUI)包含处理与表单上的控件关联的逻辑的所有例程。这些控件放置在设计时。

我在表单上遇到了几个计时器的问题。它们在GUI类中声明:

Private WithEvents timerScreenUpdate As Timer
Private WithEvents timerDebug As Timer

但我在这一行中收到错误:

Private Sub timerScreenUpdate_Tick(sender As System.Object, e As System.EventArgs) Handles timerScreenUpdate.Tick

错误是“无法找到事件'勾号”。我为另一个计时器得到了同样的错误。

这可能是相关的,但我在这一行也遇到了类似的错误:

Private Sub Monitor_FormClosing(sender As Object, e As FormClosingEventArgs) Handles MyBase.FormClosing

无法找到“事件'FormClosing'。”

如何让我的班级看到这些活动?

1 个答案:

答案 0 :(得分:0)

确保项目中的twttr.ready(   function (twttr) { twttr.events.bind( 'loaded', function (event) { var text = quote[0].content.substring(3, quote[0].content.length - 5); document.querySelector("#quote").innerHTML = text; document.querySelector(".twitter-share-button").setAttribute("data-text", text); } );   } ); 的引用和命名空间导入分别在类文件中可用。

如果没有它,VB将使用您不希望在您的案例中使用的名称空间System.Windows.Forms中的计时器。