Results 1 to 22 of 22

Thread: [RESOLVED] Help on how to update or refresh text in my animated label text

  1. #1

    Thread Starter
    Member
    Join Date
    Apr 2013
    Posts
    40

    Resolved [RESOLVED] Help on how to update or refresh text in my animated label text

    hi i need some help again... i have 2 forms, first form is the "insert announcement", 2nd form is my "main form" in my main form you can find a LABEL "LBLANNOUNCEMENT" here is the situation, one you add a announcement in 1st form then click add announcement in the 2nd form it will show in the lblannouncement, it working but my problem is updating it, i add menu editor and put announcement there, so once you click announcement in the menu the form 1 will again appear but when you click the send announcement button, the text in the lblannouncement is not changing.. here is my code:

    Form 1 is frmannounce
    Form 2 is frmnumber

    in my menu editor i added Announcement it is located at the frmnnumber

    Code:
    Private Sub Announce_Click()
    frmannounce.Show
    End Sub
    Code:
    'it is located the frmannoune
    Private Sub cmdsend_Click()
        'to send the announcement to form2
             Text1.Text = frmnumber.lblannounce.Caption
                frmnumber.Show
             Unload Me
    End Sub
    
    'it is located at the frmnumber
    Private Sub Form_Load()
        lblannounce.Caption = "Default Message" & frmannounce.Text1.Text
    End Sub
    i tried to add
    Code:
    lblannounce.refresh
    in my form load but it is not updating

    thnx hope you get my point.....

  2. #2
    PowerPoster Nightwalker83's Avatar
    Join Date
    Dec 2001
    Location
    Adelaide, Australia
    Posts
    13,344

    Re: Help on how to update or refresh text in my animated label text

    what about

    vb Code:
    1. lblannounce.Caption = ""
    when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
    If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
    https://get.cryptobrowser.site/30/4111672

  3. #3
    Default Member Bonnie West's Avatar
    Join Date
    Jun 2012
    Location
    InIDE
    Posts
    4,060

    Re: Help on how to update or refresh text in my animated label text

    You might find it easier if you had a public String variable located in a BAS module. In cmdsend_Click, you assign the announcement to the String variable and then you show frmnumber. When frmnumber loads, it sets the Caption of lblannounce to the public String variable.
    On Local Error Resume Next: If Not Empty Is Nothing Then Do While Null: ReDim i(True To False) As Currency: Loop: Else Debug.Assert CCur(CLng(CInt(CBool(False Imp True Xor False Eqv True)))): Stop: On Local Error GoTo 0
    Declare Sub CrashVB Lib "msvbvm60" (Optional DontPassMe As Any)

  4. #4
    PowerPoster
    Join Date
    Jul 2006
    Location
    Maldon, Essex. UK
    Posts
    6,334

    Re: Help on how to update or refresh text in my animated label text

    If frmNumber is already loaded then when you execute 'frmNumber.Show' the _Load event is not triggered so your code will not be executed. It'll work on the first time (i.e. when frmNumber is first Loaded) but not on subsequent ones (i.e. when it is Shown). You'd be better off moving the code from the _Load event to the _Activate event.
    Last edited by Doogle; May 16th, 2013 at 02:26 AM.

  5. #5
    Default Member Bonnie West's Avatar
    Join Date
    Jun 2012
    Location
    InIDE
    Posts
    4,060

    Re: Help on how to update or refresh text in my animated label text

    Quote Originally Posted by Doogle View Post
    You'd be better off moving the code from the _Load event to the _Activate event.
    Wouldn't frmnumber's Activate event be triggered every time focus moves from frmannounce to it?
    On Local Error Resume Next: If Not Empty Is Nothing Then Do While Null: ReDim i(True To False) As Currency: Loop: Else Debug.Assert CCur(CLng(CInt(CBool(False Imp True Xor False Eqv True)))): Stop: On Local Error GoTo 0
    Declare Sub CrashVB Lib "msvbvm60" (Optional DontPassMe As Any)

  6. #6
    PowerPoster
    Join Date
    Jul 2006
    Location
    Maldon, Essex. UK
    Posts
    6,334

    Re: Help on how to update or refresh text in my animated label text

    Yes it cetainly would - not sure whether it matters in this 'simple' case. I suppose another option would be to keep the code in the _Load event and Unload frmNumber before Showing it.

  7. #7

    Thread Starter
    Member
    Join Date
    Apr 2013
    Posts
    40

    Re: Help on how to update or refresh text in my animated label text

    Quote Originally Posted by Doogle View Post
    If frmNumber is already loaded then when you execute 'frmNumber.Show' the _Load event is not triggered so your code will not be executed. It'll work on the first time (i.e. when frmNumber is first Loaded) but not on subsequent ones (i.e. when it is Shown). You'd be better off moving the code from the _Load event to the _Activate event.
    yes thats my problem once the main form is already open the load event is not trigger.... im thinking if it can be refresh like adding in the
    Code:
    Private Sub cmdsend_Click()
        'to send the announcement to form2
             Text1.Text = frmnumber.lblannounce.Caption
                frmnumber.Show
                frmnumber.lblannounce.Refresh 
             Unload Me
    End Sub
    i tried it but its not still working... if im going to remove it in the form_load() ill put the code in the lblannouncement directly? sorry im not yet good at vb6 just starting to learn and its my first project...

    by the way the startup object is the frmannounce....

    thank you again...

  8. #8
    PowerPoster
    Join Date
    Jul 2006
    Location
    Maldon, Essex. UK
    Posts
    6,334

    Re: Help on how to update or refresh text in my animated label text

    Haven't you got the assignment the wrong way round ?

    If the 'announcement' is in Text1 in frmannounce then you should be doing
    Code:
    frmnumber.lblannounce.Caption = Text1.Text
    frmnumber.Show
    Unload Me
    then you don't need any code in frmnumber's Load event.

  9. #9
    PowerPoster Nightwalker83's Avatar
    Join Date
    Dec 2001
    Location
    Adelaide, Australia
    Posts
    13,344

    Re: Help on how to update or refresh text in my animated label text

    @Doogle,

    I was just about to suggest the same thing!

    @phatus,

    try

    vb Code:
    1. 'put in frmNumber
    2. Private Sub Form_Activate()
    3.   frmnumber.lblannounce.Refresh
    4. End Sub

    Put the above code in frmNumber.
    when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
    If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
    https://get.cryptobrowser.site/30/4111672

  10. #10

    Thread Starter
    Member
    Join Date
    Apr 2013
    Posts
    40

    Re: Help on how to update or refresh text in my animated label text

    Quote Originally Posted by Doogle View Post
    Haven't you got the assignment the wrong way round ?

    If the 'announcement' is in Text1 in frmannounce then you should be doing
    Code:
    frmnumber.lblannounce.Caption = Text1.Text
    frmnumber.Show
    Unload Me
    then you don't need any code in frmnumber's Load event.
    i have also tired that but in my form_Load event in the frmnumber theres a default message

    Code:
    'it is located at the frmnumber
    Private Sub Form_Load()
        lblannounce.Caption = "Default Message" & frmannounce.Text1.Text
    End Sub
    the default message will be ignored when i tried to change it to
    Code:
    frmnumber.lblannounce.Caption = Text1.Text
    i tried this too
    Code:
    frmnumber.lblannounce.Caption = "Default Message" & Text1.Text
    but the animation effect is very bad...
    is there another way?
    thanx

  11. #11
    PowerPoster Nightwalker83's Avatar
    Join Date
    Dec 2001
    Location
    Adelaide, Australia
    Posts
    13,344

    Re: Help on how to update or refresh text in my animated label text

    It should be

    vb Code:
    1. frmnumber.lblannounce.Caption = frmnumber.lblannounce.Caption & " "  & Text1.Text
    when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
    If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
    https://get.cryptobrowser.site/30/4111672

  12. #12

    Thread Starter
    Member
    Join Date
    Apr 2013
    Posts
    40

    Re: Help on how to update or refresh text in my animated label text

    here is my complete code in frmannounce and frmnumber

    frmannounce

    Code:
    Private Sub cmdsend_Click()
    Text1.Text = frmnumber.lblannounce.Caption
    frmnumber.Show
    Unload Me
    End Sub

    frmnumber

    Code:
    Option Explicit
    
    Private spk As SpVoice
    Private Declare Function Beep Lib "kernel32" _
    (ByVal dwFreq As Long, ByVal dwDuration As Long) As Long
    
    Private Sub Abouts_Click()
    frmAbout.Show
    End Sub
    
    Private Sub Announce_Click()
    frmannounce.Show
    End Sub
    
    Private Sub Exit_Click()
    Dim response As String
        response = MsgBox("Are You Sure You Want To Close The Program", vbYesNo, "Exit")
            If response = vbYes Then
                End
                Else
                    Me.Show
                    End If
            End Sub
    
    Private Sub SpeakIt(strWords As String)
        If strWords <> vbNullString Then
            spk.Speak strWords
        End If
    End Sub
    
    Private Sub Form_Load()
        lblannounce.Caption = "You can check the status of your document online with your tracking number  Icon...     " & frmannounce.Text1.Text & "... "
        Timer1.Enabled = True
        Timer1.Interval = 300
        
        Set spk = New SpVoice
        
        Dim cx As Long
        Dim cy As Long
        Dim RetVal As Long
    
       
        lbldate.Caption = Format(Now, "mmmm dd,yyyy")
            Timer1.Interval = 200
    
    'playing sound
    Dim app_path As String
        app_path = App.Path
            If Right$(app_path, 1) <> "\" Then
                app_path = app_path & "\"
                    txtmusic.Text = app_path & "BuddyIsOnline.wav"
            End If
            
    With mmcplayer
        .Notify = False
            .Wait = True
                .Shareable = False
                    .Command = "close"
    
    End With
    End Sub
    
    Private Sub mmcplayer_done(notifycode As Integer)
        mmcplayer.Command = "close"
        lblaudio.Caption = ""
    End Sub
    
    Private Sub mmcplayer_statusupdate()
        lblaudio.Caption = mmcplayer.Position & "/" & mmcplayer.Length
    End Sub
    
    Private Sub lblreceive_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
    If Button = 1 Then
        lblreceive.Caption = Val(lblreceive.Caption) + 1
    
        SpeakIt "Now Serving Number" & lblreceive.Caption & "at receiving window"
            
            With mmcplayer
                If lblreceive.Caption = lblreceive.Caption <= 30 Then
            
                    .FileName = txtmusic.Text
                        .Command = "open"
                          .Command = "play"
                Else
                    .Command = "stop"
                          .Command = "close"
                End If
            End With
    End If
    
    If lblreceive.Caption = 31 Then
        lblreceive.Caption = "0"
    End If
    
    
    If Button = 2 Then
        lblreceive.Caption = Val(lblreceive.Caption) - 1
    End If
    
    Dim response As String
    If lblreceive.Caption < 0 Then
        response = MsgBox("Reset to 0", vbExclamation, "ERROR")
            lblreceive.Caption = Val(lblreceive.Caption) + 1
    End If
       
    End Sub
    
    Private Sub lblrelease_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
        If Button = 1 Then
          lblrelease.Caption = Val(lblrelease.Caption) + 1
        
        SpeakIt "Now Serving Number" & lblrelease.Caption & "at releasing window"
            
            With mmcplayer
                If lblrelease.Caption = lblrelease.Caption <= 30 Then
                    .FileName = txtmusic.Text
                    .Command = "open"
                    .Command = "play"
                Else
                    .Command = "stop"
                    .Command = "close"
                End If
            End With
       End If
    
    If Button = 2 Then
        lblrelease.Caption = Val(lblrelease.Caption) - 1
    End If
    
    If lblrelease.Caption = 31 Then
        lblrelease.Caption = "0"
    End If
    
    If lblrelease.Caption < 0 Then
        Dim response As String
            response = MsgBox("Reset to 0", vbExclamation, "ERROR")
            lblrelease.Caption = "0"
    End If
    End Sub
    Private Sub Timer1_Timer()
        lblhr.Caption = Format$(Now, "hh:mm:ss AM/PM")
        Dim str As String
        str = frmnumber.lblannounce.Caption
        str = Mid$(str, 2, Len(str)) + Left(str, 1)
        frmnumber.lblannounce.Caption = str
    End Sub
    my only problem is when updating the announcement when the frmnumber is loaded it wont update so inneed to exit the program first then update the announcement...

    thanx...

  13. #13
    PowerPoster
    Join Date
    Jul 2006
    Location
    Maldon, Essex. UK
    Posts
    6,334

    Re: Help on how to update or refresh text in my animated label text

    You need to make frmnumber's lblannounce.Caption independent from the Form Load event. One way would be to set the label's Caption in frnannounce.
    frmannounce:
    Code:
    Private Sub cmdsend_Click()
    frmnumber.lblannounce.Caption = "You can check the status of your document online with your tracking number  Icon...     " & Text1.Text & "... "
    frmnumber.Show
    Unload Me
    End Sub
    and remove
    Code:
        lblannounce.Caption = "You can check the status of your document online with your tracking number  Icon...     " & frmannounce.Text1.Text & "... "
    from frnnumber's Load event

  14. #14

    Thread Starter
    Member
    Join Date
    Apr 2013
    Posts
    40

    Re: Help on how to update or refresh text in my animated label text

    Quote Originally Posted by Doogle View Post
    You need to make frmnumber's lblannounce.Caption independent from the Form Load event. One way would be to set the label's Caption in frnannounce.
    frmannounce:
    Code:
    Private Sub cmdsend_Click()
    frmnumber.lblannounce.Caption = "You can check the status of your document online with your tracking number  Icon...     " & Text1.Text & "... "
    frmnumber.Show
    Unload Me
    End Sub
    and remove
    Code:
        lblannounce.Caption = "You can check the status of your document online with your tracking number  Icon...     " & frmannounce.Text1.Text & "... "
    from frnnumber's Load event
    theres a problem on that when you click the File>Announcement in the menu and the frmannounce will appear and when you put another announcement for update
    i attached my project so that you can see what i mean....
    Last edited by phatus; May 16th, 2013 at 04:36 AM. Reason: deleted attached file

  15. #15
    PowerPoster
    Join Date
    Jul 2006
    Location
    Maldon, Essex. UK
    Posts
    6,334

    Re: Help on how to update or refresh text in my animated label text

    For some reason I can't open your .zip file, system is telling me 'invalid format'

  16. #16

    Thread Starter
    Member
    Join Date
    Apr 2013
    Posts
    40

    Re: Help on how to update or refresh text in my animated label text

    sorry i forget to tell you i just rename it to zip its a rar file ^ ^... kindly rename the extension to .rar

  17. #17
    PowerPoster
    Join Date
    Jul 2006
    Location
    Maldon, Essex. UK
    Posts
    6,334

    Re: Help on how to update or refresh text in my animated label text

    I can't open .rar files. Can you please use zip ?

  18. #18

    Thread Starter
    Member
    Join Date
    Apr 2013
    Posts
    40

    Re: Help on how to update or refresh text in my animated label text

    ok for a while im installing zip sorry

    here it is in zip format
    Attached Files Attached Files
    Last edited by phatus; May 16th, 2013 at 04:33 AM.

  19. #19
    PowerPoster
    Join Date
    Jul 2006
    Location
    Maldon, Essex. UK
    Posts
    6,334

    Re: Help on how to update or refresh text in my animated label text

    Still says invalid format

  20. #20

    Thread Starter
    Member
    Join Date
    Apr 2013
    Posts
    40

    Re: Help on how to update or refresh text in my animated label text

    here it is i make another hope this work
    Last edited by phatus; May 17th, 2013 at 12:25 AM.

  21. #21
    PowerPoster
    Join Date
    Jul 2006
    Location
    Maldon, Essex. UK
    Posts
    6,334

    Re: Help on how to update or refresh text in my animated label text

    I changed frmannounce to
    Code:
    Private Sub cmdsend_Click()
    frmnumber.lblannounce.Caption = " You can check the status of your document online with your tracking number @ www.depedcamsur.com and look for DOTs Icon... " & Text1.Text & "... "
    frmnumber.Show
    Unload Me
    End Sub
    and it appears to work.

  22. #22

    Thread Starter
    Member
    Join Date
    Apr 2013
    Posts
    40

    Re: Help on how to update or refresh text in my animated label text

    yay thanx its working now

    thank you very much sir.. until next time...

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