Hi
Please tell vb.net equivalent of following method:

private void LookForUpdates()
        {
            System.Threading.ThreadStart timerThreadStart = new System.Threading.ThreadStart(delegate()
            {

                sua = new ShowUpdatAvailable();
                DelGetUpdateArgs delGetUpdateArgs = new DelGetUpdateArgs(this.GetUpdateArgs);
                sua.GetUpdateArgs = delGetUpdateArgs;
                sua.StartLookingForUpdate();

            });

            timerThread = new System.Threading.Thread(timerThreadStart);
            timerThread.Start();
        }

I tried using C# to VB.NET code converter which gave me this:

Private Sub LookForUpdates()
            Dim timerThreadStart As New System.Threading.ThreadStart(Function() Do

        sua = New My.ShowUpdatAvailable()
        Dim delGetUpdateArgs As New DelGetUpdateArgs(AddressOf Me.GetUpdateArgs)
        sua.GetUpdateArgs = delGetUpdateArgs

        sua.StartLookingForUpdate()
            End Function)

            timerThread = New System.Threading.Thread(timerThreadStart)
            timerThread.Start()
        End Sub

Which on build in visual studio 2005 gives an error.

Please help

Edited 7 Years Ago by nccsbim071: n/a

VB.NET doesn't support anonymous delegates like C# does. Just break the code out to another function:

Private Sub LookForUpdates()
		Dim timerThreadStart As New System.Threading.ThreadStart(AddressOf LookForUpdatesDelegate)
		Dim timerThread As New System.Threading.Thread(timerThreadStart)
		timerThread.Start()
	End Sub

	Private Sub LookForUpdatesDelegate()
		sua = New My.ShowUpdatAvailable()
		Dim delGetUpdateArgs As New DelGetUpdateArgs(AddressOf Me.GetUpdateArgs)
		sua.GetUpdateArgs = delGetUpdateArgs
		sua.StartLookingForUpdate()
	End Sub
This question has already been answered. Start a new discussion instead.