Get the TextBox.Text from within thread

Peter Volz 1,295 Reputation points

Hello all, Is this correct to get the text inside a TextBox from within thread? Private Delegate Function GetDSPNCallback() As String Private Function GetDSPN() As String If DTextBoxX.InvokeRequired Then Invoke(Sub() GetDSPN = DTextBoxX.Text.Trim) Else GetDSPN = DTextBoxX.Text.Trim End If End Function Thank you

An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,408 questions
An object-oriented programming language developed by Microsoft that is implemented on the .NET Framework. Previously known as Visual Basic .NET.
2,610 questions
0 comments No comments
{count} votes

Accepted answer
  1. Viorel 113.2K Reputation points

    Check this:

    Private Function GetDSPN() As String
        Dim t As String = Nothing
        Invoke(Sub() t = DTextBoxX.Text.Trim)
        Return t
    End Function
    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful