-
[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.....
-
Re: Help on how to update or refresh text in my animated label text
-
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.
-
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.
-
Re: Help on how to update or refresh text in my animated label text
Quote:
Originally Posted by
Doogle
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?
-
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.
-
Re: Help on how to update or refresh text in my animated label text
Quote:
Originally Posted by
Doogle
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...
-
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.
-
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:
'put in frmNumber
Private Sub Form_Activate()
frmnumber.lblannounce.Refresh
End Sub
Put the above code in frmNumber.
-
Re: Help on how to update or refresh text in my animated label text
Quote:
Originally Posted by
Doogle
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
-
Re: Help on how to update or refresh text in my animated label text
It should be
vb Code:
frmnumber.lblannounce.Caption = frmnumber.lblannounce.Caption & " " & Text1.Text
-
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...
-
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
-
Re: Help on how to update or refresh text in my animated label text
Quote:
Originally Posted by
Doogle
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....
-
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'
-
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
-
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 ?
-
1 Attachment(s)
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
-
Re: Help on how to update or refresh text in my animated label text
Still says invalid format
-
Re: Help on how to update or refresh text in my animated label text
here it is i make another hope this work
-
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.
-
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...