I am trying to convert someone else's VB code to be option strict compliant. Here is the Code:

Dim WaitForAuthTimer As New System.Timers.Timer(1000)
Dim RefreshMessagesTimer As New System.Timers.Timer(10000)
Dim RefreshStatusesTimer As New System.Timers.Timer(300000)
Dim SyncUITimer As New System.Timers.Timer(1000)

Then in a sub:

AddHandler WaitForAuthTimer.Elapsed, AddressOf WaitForAuth
AddHandler RefreshMessagesTimer.Elapsed, AddressOf GetMessagesAsTask
AddHandler RefreshStatusesTimer.Elapsed, AddressOf GetStatuses
AddHandler SyncUITimer.Elapsed, AddressOf RefreshMessages

The error is:

Error BC36663
Option Strict On does not allow narrowing in implicit type conversions between method 'Public Sub WaitForAuth()' and delegate 'Delegate Sub ElapsedEventHandler(sender As Object, e As ElapsedEventArgs)'

0 Answers