Click here to Skip to main content
       

Visual Basic

 
QuestionTry Catch does not Execute Catch code [modified] Pinmembertreddie2-May-13 19:31 
AnswerRe: Try Catch does not Execute Catch code PinmvpRichard MacCutchan2-May-13 22:41 
GeneralRe: Try Catch does not Execute Catch code Pinmembertreddie2-May-13 23:02 
QuestionMethod signature does not match delegate - thread safe PinmemberMember 100187622-May-13 8:12 
I am very new to programming... I have opened a vb2003 application in visual studio 2010 and have had some thread safe problems when trying to modify a text box from a non-parent form. I implemented the below that I found on a thread with good results:
Private Sub SetLabelText(ByVal s As String)
 
    If Me.lbTime.InvokeRequired Then
        Me.lbTime.Invoke(New Action(Of String)(AddressOf SetLabelText), s)
        'Me.lbTime.Invoke(New Action(Of String)(AddressOf SetLabelText), s)
    Else
        Me.lbTime.Text = s
    End If
End Sub
 

Now when I try to modify the attached for an array of textboxes, while passing the array index into the sub routine I get a "Does not have a signature compatible with the delegate." error. Is it possible to have a delegate with multuple parameters? Is there an easier way to accomplish a threadsafe multiple textbox modifications?
 
Private Sub SettxtChannelData(ByVal arrIndex As Integer, ByVal s As String)
    If Me.txtChannelData(arrIndex).InvokeRequired Then
        Me.txtChannelData(arrIndex).Invoke(New Action(Of String)(AddressOf SettxtChannelData), s)
    Else
        Me.txtChannelData(arrIndex).Text = s
    End If
End Sub

AnswerRe: Method signature does not match delegate - thread safe PinprofessionalRichard Deeming2-May-13 9:21 
GeneralRe: Method signature does not match delegate - thread safe PinmemberMember 100187622-May-13 12:00 
GeneralRe: Method signature does not match delegate - thread safe PinmemberAlan N2-May-13 13:26 
QuestionTrouble passing arguments to System.Diagnostics.Process.Start Pinmembersavedlema2-May-13 1:07 
AnswerRe: Trouble passing arguments to System.Diagnostics.Process.Start [modified] PinmvpRichard MacCutchan2-May-13 2:07 
GeneralRe: Trouble passing arguments to System.Diagnostics.Process.Start PinprofessionalRichard Deeming2-May-13 2:23 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.


Advertise | Privacy | Mobile
Web01 | 2.8.141223.1 | Last Updated 23 Dec 2014
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid