CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Threaded View

  1. #1
    Join Date
    Dec 2008
    Posts
    19

    Help: what's wrong with this code snippet?

    Code:
    public notinheritable class myClass
    
    Private txt As String = ""
    
    Public Delegate Sub SetInfoPercentageDelegate(ByVal Percentage As Integer)
    
    Public Sub SetInfo(ByVal Text As String)
    
    txt = Text
    
    If Me.InvokeRequired Then
    
    Dim SI As New SetInfoTextDelegate(AddressOf SetInfo)
    
    Me.Invoke(SI, New Object() {Text})
    
    Else
    
    tbStatus.Text = Text
    
    End If
    
    End Sub
    
    End class
    My problem: According to my reasoning, when an invoke is required, the if condition is satisfied and the program should execute the IF part. And since in the IF part, the Setinfo method is invoked, the program should run through the Else part on the next step. But it doesn't do so... Can anybody help me with this? Thanks.
    Last edited by HanneSThEGreaT; February 14th, 2009 at 04:32 AM. Reason: Added Code Tags!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured