我正在尝试在VB中编写一些代码,实际上我从论坛中获取了这些代码。
这是:
Protected Override Sub Dispose(disposing As Boolean)
Try
Dim flag As Boolean = disposing AndAlso Me.components IsNot Nothing
If flag Then
Me.components.Dispose()
End If
Finally
MyBase.Dispose(disposing)
End Try
End Sub
我不断在每行中出现错误,例如:“语句结束”,“语法错误”和“语句不能出现在方法体/多行lambda之外” 我有Visual Studio 12顺便说一句。
答案 0 :(得分:1)
你错过了Overrides上的s。 =)
Protected Overrides Sub Dispose(disposing As Boolean)
Try
Dim flag As Boolean = disposing AndAlso Me.components IsNot Nothing
If flag Then
Me.components.Dispose()
End If
Finally
MyBase.Dispose(disposing)
End Try
End Sub