Question threading problem, wrong signature

lbytesxk

Member
Joined
May 7, 2008
Messages
5
Programming Experience
3-5
Hi, I have a problem that I can't seem to resolve, the following very simple code is trying to run the private function in its own thread, the public function by the same name is called from another class, it does not return anything does not pass anything, yet I get the error:
"C:\VB2003\TestStepClass\TestSteps\TestSteps\TestEngine.vb(60): Method 'Private Function _ExecuteTestStep() As Object' does not have the same signature as delegate 'Delegate Sub ThreadStart()'.
Here is the code, as we can see _ExecuteTestStep does not return any objects, I'm stomped, anyone may have seen something like this? Thanks in advance

VB.NET:
Imports System
Imports System.Threading
Imports BusinessLibrary.BEIBusiness

Namespace SELTestSteps
    Public Class TestEngine

        Private m_pass As Boolean
        Private m_testMessage As String
        Private m_startTime As DateTime
        Private m_stopTime As DateTime
        Private m_currentIndex As Integer
        Private m_nextIndex As Integer
        Private tstSteps As TestSteps
        Public Sub New()

        End Sub
#Region "properties"
        Public ReadOnly Property Pass() As Boolean
            Get
                Return m_pass
            End Get

        End Property

        Public ReadOnly Property TestMessage() As String
            Get
                Return m_testMessage
            End Get
        End Property

        Public ReadOnly Property StartTime() As DateTime
            Get
                Return m_startTime
            End Get
        End Property

        Public ReadOnly Property StopTime() As DateTime
            Get
                Return m_stopTime
            End Get
        End Property

        Public ReadOnly Property NextIndex() As Integer
            Get
                Return m_nextIndex
            End Get
        End Property

        Public ReadOnly Property CurrentIndex() As Integer
            Get
                Return m_currentIndex
            End Get
        End Property
#End Region


        Public Function ExecuteTestStep(ByVal iStep As Integer)

            Dim stepThread As New Thread(AddressOf _ExecuteTestStep)
            stepThread.Start()


        End Function

        Private Function _ExecuteTestStep()

            If tstSteps Is Nothing Then tstSteps = New TestSteps




        End Function
    End Class
End Namespace
 
Function methods always return something, even you neglect to define it properly with a return type, in which case as the error says the return type is Object. In your case you want to change "Function" to "Sub".
 
Back
Top