不能重载 Windows.Forms.Timer.Stop() - 子名称不能是关键字

Can't overload Windows.Forms.Timer.Stop() - Sub-Name must not be a keyword

我有一个包含大约 15.000 行代码的应用程序。它向用户显示一些数据。为了保持数据更新,它是 运行 a Windows.Forms.Timer 。显示的数据在每个刻度上更新。

为了避免 SQL 服务器上不必要的网络流量和计算机使用,一旦用户使用 .Enabled = False.Stop() 进入子表单,计时器就会停止。当他们关闭子表单时,计时器将以 .Start().Enabled = True 重新启动。

代码中的某处有问题,导致计时器完全停止,因此数据将不再刷新。我需要找出发生这种情况的地方。

为此,我正在创建一个 new classInherits Windows.Forms.Timer。我想 overload Enabled 属性、Start()Stop() 子。

事实证明我做不到。

试图重载 Stop() sub 使我陷入 Visual Studio 显示的错误,告诉我,我不允许使用 'Stop()' 作为子名称,因为它是关键词。这不仅仅是一个警告,而且是一个阻止我编译的错误。

我可以为这些特定的行关闭这个错误吗?或者你能给我一个不同的方法来解决主要问题吗?

Public Class MyApp_RefreshTimer
    Inherits Windows.Forms.Timer

    Private Overloads Property Enabled As Boolean
        Get
            ' A part of my logging will be placed here.. probably
            Return MyBase.Enabled
        End Get
        Set(value As Boolean)
            MyBase.Enabled = value
        End Set
    End Property

    Public Overloads Sub Stop()

    End Sub

End Class

由于 "Stop" 是关键字,因此您必须将过程名称括起来:

Public Overloads Sub [Stop]()

End Sub