Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
The AddressOf operator creates a procedure delegate instance that references a specific procedure. The syntax is as follows:
AddressOf procedurename
You inserted parentheses around the argument following AddressOf, where none are needed.
Error ID: BC30577
Example
The following example generates bc30577:
Public Sub CountZeroToTen()
For i = 0 To 10
Console.WriteLine($"Counted: {i}")
Threading.Thread.Sleep(500)
Next
End Sub
Sub Main()
' Any of the following two lines generates bc30577.
'Dim t As New Threading.Thread(AddressOf(CountZeroToTen))
'Dim t As New Threading.Thread(AddressOf CountZeroToTen())
t.Start()
End Sub
To correct this error
Remove the parentheses around the argument following
AddressOfas shown in the following example:Public Sub CountZeroToTen() For i = 0 To 10 Console.WriteLine($"Counted: {i}") Threading.Thread.Sleep(500) Next End Sub Sub Main() Dim t As New Threading.Thread(AddressOf CountZeroToTen) t.Start() End SubMake sure the argument is a method name.