Update a control's text from another class...?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Gadjuka
    New Member
    • Nov 2007
    • 3

    Update a control's text from another class...?

    Hi all!

    I'm trying to do a pretty simple thing in VB6, but it's not working!

    In the main form:
    Code:
    Sub Command1_Click()
        Dim cls1 As New Class1
        cls1.fnc1 StatusBar1.SimpleText
    end sub
    And in Class1:
    Code:
    Function fnc1(ByRef logText As String)
        Dim i as Integer
        For i=0 To 10
            logText = "We're at number " & i
        Next
    End Function
    I though this would update the statusbar text in real time, but it doesn't work!
    Anyone knows why?
  • debasisdas
    Recognized Expert Expert
    • Dec 2006
    • 8119

    #2
    What is the return type of the function ?

    You are not assigning back anything to the statusbar.

    Comment

    • Gadjuka
      New Member
      • Nov 2007
      • 3

      #3
      Originally posted by debasisdas
      What is the return type of the function ?

      You are not assigning back anything to the statusbar.
      I don't think the function should have to return anything (I could have made it into a sub). The goal is to update the statusbar while cls1.fnc1() is running. By sending the statusbar's text property as a reference I should be modifying the actual object, thus updating the real statusbar. Unfortunately the statusbar remains empty!

      Comment

      Working...