|
-
Sep 9th, 2008, 04:23 AM
#1
Thread Starter
Fanatic Member
Blinking Letters...
What's up guys?!
I have another problem... It's about my loading message..
I've created a Label box and it's caption is "loading...".
Now, I can make the whole caption blink every second using the timer button. I wanted to try something and I can't do it but it is possible.
I want the letters to blink with each second passes by...
Example:
loading...
oading...
l ading...
lo ding...
loa ing...
load ng...
loadi g...
loadin ...
loading ..
loading. .
loading..
loading...
It is possible but all I could think of is create 9 label boxes.
Got any idea guys? I wanted to try something new that's why I'm doing this...
Thanks!
Manny Pacquiao once posted in his twitter:
It doesn't matter if the grammar is wrong, what matter is that you get the message
-
Sep 9th, 2008, 04:26 AM
#2
Re: Blinking Letters...
You don't need many lables... just one label and one timer...
in the click event of the timer change the caption every second...
A good exercise for the Heart is to bend down and help another up...
Please Mark your Thread " Resolved", if the query is solved
MyGear:
★ CPU ★ Ryzen 5 5800X
★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
★ Keyboard ★ TVS Electronics Gold Keyboard
★ Mouse ★ Logitech G502 Hero
-
Sep 9th, 2008, 04:34 AM
#3
Thread Starter
Fanatic Member
Re: Blinking Letters...
 Originally Posted by koolsid
You don't need many lables... just one label and one timer...
in the click event of the timer change the caption every second...
I'll try...
Manny Pacquiao once posted in his twitter:
It doesn't matter if the grammar is wrong, what matter is that you get the message
-
Sep 9th, 2008, 04:36 AM
#4
Re: Blinking Letters...
here is a basic example without the timer and label...modify it as per your requirements...
Code:
Sub aaa()
strg = "loading"
tempstr = " "
For i = 1 To Len(Trim(strg))
MsgBox Replace(strg, Mid(strg, i, 1), tempstr)
Next i
End Sub
A good exercise for the Heart is to bend down and help another up...
Please Mark your Thread " Resolved", if the query is solved
MyGear:
★ CPU ★ Ryzen 5 5800X
★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
★ Keyboard ★ TVS Electronics Gold Keyboard
★ Mouse ★ Logitech G502 Hero
-
Sep 9th, 2008, 04:46 AM
#5
If my post was helpful to you, then express your gratitude using Rate this Post. 
And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet
Social Group: VBForums - Developers from India
Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...
-
Sep 9th, 2008, 04:49 AM
#6
Thread Starter
Fanatic Member
Re: Blinking Letters...
Like this?...
Code:
Dim i as integer
Dim x as integer
Private Sub Form_Load()
Timer1.Enabled = False
Timer1.Interval = 1000
x = 9
Label1.Caption = loading...
End Sub
Private Sub cmdStart()
Timer1.Enabled = True
Timer
End Sub
Private Sub Timer1_Timer()
For i =0 to 9
If x = 9 then
Label1.Caption = " oading..."
Elseif x = 8 then
Label1.Caption = "l ading..."
Elseif x = 7 then
Label1.Caption = "lo ding..."
Elseif x = 6 then
Label1.Caption = "loa ing..."
Elseif x = 5 then
Label1.Caption = "load ng..."
Elseif x = 4 then
Label1.Caption = "loadi g..."
Elseif x = 3 then
Label1.Caption = "loadin ..."
Elseif x = 2 then
Label1.Caption = "loading .."
Elseif x = 1 then
Label1.Caption = "loading. ."
Elseif x = 0 then
Label1.Caption = "loading.. "
Timer1.Enabled = False
End if
If x <> 0 then
x = x - 1
End if
Next i
End Sub
Can you guys correct me if I'm wrong or do you have any better ideas?..
Thanks again...
Manny Pacquiao once posted in his twitter:
It doesn't matter if the grammar is wrong, what matter is that you get the message
-
Sep 9th, 2008, 04:50 AM
#7
Thread Starter
Fanatic Member
Re: Blinking Letters...
I don't have a vb here either..
Manny Pacquiao once posted in his twitter:
It doesn't matter if the grammar is wrong, what matter is that you get the message
-
Sep 9th, 2008, 04:51 AM
#8
Re: Blinking Letters...
did you check the code that I gave
this
Code:
Label1.Caption = Replace(strg, Mid(strg, i, 1), tempstr)
in a loop will give you desired results...
A good exercise for the Heart is to bend down and help another up...
Please Mark your Thread " Resolved", if the query is solved
MyGear:
★ CPU ★ Ryzen 5 5800X
★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
★ Keyboard ★ TVS Electronics Gold Keyboard
★ Mouse ★ Logitech G502 Hero
-
Sep 9th, 2008, 04:54 AM
#9
Thread Starter
Fanatic Member
Re: Blinking Letters...
 Originally Posted by koolsid
here is a basic example without the timer and label...modify it as per your requirements...
Code:
Sub aaa()
strg = "loading"
tempstr = " "
For i = 1 To Len(Trim(strg))
MsgBox Replace(strg, Mid(strg, i, 1), tempstr)
Next i
End Sub
I haven't tested this one yet but it sure is a lot shorter than my code.. Thanks..
I was busy typing the codes and show it you guys...
Manny Pacquiao once posted in his twitter:
It doesn't matter if the grammar is wrong, what matter is that you get the message
-
Sep 9th, 2008, 04:55 AM
#10
Thread Starter
Fanatic Member
Re: Blinking Letters...
I can replace the Message Box with a Label Box right?...
Manny Pacquiao once posted in his twitter:
It doesn't matter if the grammar is wrong, what matter is that you get the message
-
Sep 9th, 2008, 04:56 AM
#11
Re: Blinking Letters...
since you don't have vb6, copy the code mentioned in post 4 and paste it in a module in VBA Excel... and then run it... it will give you a fair idea...
If you need trailing dots after "loading " then change
strg ="Loading..."
A good exercise for the Heart is to bend down and help another up...
Please Mark your Thread " Resolved", if the query is solved
MyGear:
★ CPU ★ Ryzen 5 5800X
★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
★ Keyboard ★ TVS Electronics Gold Keyboard
★ Mouse ★ Logitech G502 Hero
-
Sep 9th, 2008, 04:57 AM
#12
Re: Blinking Letters...
 Originally Posted by louvelle
I can replace the Message Box with a Label Box right?...
yes like I mentioned above in post 8
A good exercise for the Heart is to bend down and help another up...
Please Mark your Thread " Resolved", if the query is solved
MyGear:
★ CPU ★ Ryzen 5 5800X
★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
★ Keyboard ★ TVS Electronics Gold Keyboard
★ Mouse ★ Logitech G502 Hero
-
Sep 9th, 2008, 04:58 AM
#13
Re: Blinking Letters...
My code is:
Code:
Dim n as integer
Private Sub Form_Load()
Timer1.Enabled = False
Timer1.Interval = 1000
End Sub
Private Sub cmdStart()
Timer1.Enabled = True
n=0
End Sub
Private Sub Timer1_Timer()
If n=0 then
label1.caption="loading..."
elseif n=1 then
label1.caption=" oading..."
elseif n=2 then
label1.caption="l ading..."
elseif n=3 then
label1.caption="lo ding..."
elseif n=4 then
label1.caption="loa ing..."
elseif n=5 then
label1.caption="load ng..."
elseif n=6 then
label1.caption="loadi g..."
elseif n=7 then
label1.caption="loadin ..."
elseif n=8 then
label1.caption="loading .."
elseif n=9 then
label1.caption="loading. ."
elseif n=10 then
label1.caption="loading.. "
end if
if n=10 then
n=0
else
n=n+1
end if
End Sub
That's what my idea is...
You can also use another timer to blink everything in the label, like this:
Code:
Private Sub Timer2_Timer()
If label1.visible=true then
label1.visible=false
elseIf label1.visible=false then
label1.visible=true
end if
End Sub
Set the timer2's interval property to 500 or something.....
That can give you some more different experience..
-Good luck
If my post was helpful to you, then express your gratitude using Rate this Post. 
And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet
Social Group: VBForums - Developers from India
Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...
-
Sep 9th, 2008, 05:00 AM
#14
Thread Starter
Fanatic Member
Re: Blinking Letters...
 Originally Posted by akhileshbc
My code is:
Code:
Dim n as integer
Private Sub Form_Load()
Timer1.Enabled = False
Timer1.Interval = 1000
End Sub
Private Sub cmdStart()
Timer1.Enabled = True
n=0
End Sub
Private Sub Timer1_Timer()
If n=0 then
label1.caption="loading..."
elseif n=1 then
label1.caption=" oading..."
elseif n=2 then
label1.caption="l ading..."
elseif n=3 then
label1.caption="lo ding..."
elseif n=4 then
label1.caption="loa ing..."
elseif n=5 then
label1.caption="load ng..."
elseif n=6 then
label1.caption="loadi g..."
elseif n=7 then
label1.caption="loadin ..."
elseif n=8 then
label1.caption="loading .."
elseif n=9 then
label1.caption="loading. ."
elseif n=10 then
label1.caption="loading.. "
end if
if n=10 then
n=0
else
n=n+1
end if
End Sub
That's what my idea is... 
You can also use another timer to blink everything in the label, like this:
Code:
Private Sub Timer2_Timer()
If label1.visible=true then
label1.visible=false
elseIf label1.visible=false then
label1.visible=true
end if
End Sub
Set the timer2's interval property to 500 or something.....
That can give you some more different experience..
-Good luck 
LOL.. I did make use of the visible properties of a Label Box to make it blink..
So you don't need a for loop right?.. Thanks...
Manny Pacquiao once posted in his twitter:
It doesn't matter if the grammar is wrong, what matter is that you get the message
-
Sep 9th, 2008, 05:03 AM
#15
Re: Blinking Letters...
I can replace the Message Box with a Label Box right?...
What you mean by this..????
Are you saying that you want to display a window that shows some visuals like "Loading..... Please wait...", whenever you wish..???
If my post was helpful to you, then express your gratitude using Rate this Post. 
And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet
Social Group: VBForums - Developers from India
Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...
-
Sep 9th, 2008, 05:07 AM
#16
Thread Starter
Fanatic Member
Re: Blinking Letters...
 Originally Posted by akhileshbc
What you mean by this..????
Are you saying that you want to display a window that shows some visuals like "Loading..... Please wait...", whenever you wish..???
Yeah.. Something like that...
Manny Pacquiao once posted in his twitter:
It doesn't matter if the grammar is wrong, what matter is that you get the message
-
Sep 9th, 2008, 05:08 AM
#17
Thread Starter
Fanatic Member
Re: Blinking Letters...
I just used a command button for an example only..
Manny Pacquiao once posted in his twitter:
It doesn't matter if the grammar is wrong, what matter is that you get the message
-
Sep 9th, 2008, 05:09 AM
#18
Re: Blinking Letters...
LOL.. I did make use of the visible properties of a Label Box to make it blink..
So you don't need a for loop right?.. Thanks...
yes, no loop needed for my code. I think my code is a bit lengthy..
There are many ways to solve a problem. Some of them may be simple and some may be complex... You can select what ever you wish..
One thing I want to ask you, what is LOL? Can you tell me the meaning or the full form of it...
-regards
Akhilesh
If my post was helpful to you, then express your gratitude using Rate this Post. 
And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet
Social Group: VBForums - Developers from India
Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...
-
Sep 9th, 2008, 05:11 AM
#19
Re: Blinking Letters...
Yeah.. Something like that...
Then you need some more coding...
If my post was helpful to you, then express your gratitude using Rate this Post. 
And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet
Social Group: VBForums - Developers from India
Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...
-
Sep 9th, 2008, 05:15 AM
#20
Thread Starter
Fanatic Member
Re: Blinking Letters...
LOL means laughing out loud..
Ahaha.... (Like this)
LOL
Manny Pacquiao once posted in his twitter:
It doesn't matter if the grammar is wrong, what matter is that you get the message
-
Sep 9th, 2008, 05:15 AM
#21
Thread Starter
Fanatic Member
Re: Blinking Letters...
 Originally Posted by akhileshbc
Then you need some more coding... 
Yup.. I'll try the codes later... I'm at work..
Manny Pacquiao once posted in his twitter:
It doesn't matter if the grammar is wrong, what matter is that you get the message
-
Sep 9th, 2008, 05:21 AM
#22
Re: Blinking Letters...
Code:
Dim n, t as integer
Private Sub Form_Load()
Timer1.Enabled = True
Timer1.Interval = 1000
n=0
t=1
End Sub
Private Sub Timer1_Timer()
If n < 6 then 'here the blinking loading is done for 5 times
If n=0 then
label1.caption="loading..."
elseif n=1 then
label1.caption=" oading..."
elseif n=2 then
label1.caption="l ading..."
elseif n=3 then
label1.caption="lo ding..."
elseif n=4 then
label1.caption="loa ing..."
elseif n=5 then
label1.caption="load ng..."
elseif n=6 then
label1.caption="loadi g..."
elseif n=7 then
label1.caption="loadin ..."
elseif n=8 then
label1.caption="loading .."
elseif n=9 then
label1.caption="loading. ."
elseif n=10 then
label1.caption="loading.. "
end if
if n=10 then
n=0
else
n=n+1
end if
t=t+1
else
timer1.enabled=false 'after the 5th time, timer is disabled and the loading form
unload me 'is unloaded
end if
End Sub
This is the only thing you need to have inside a separate form...
When you wish to show that form for loading, simply use this:
Code:
Load frmLoading
frmLoading.show vbmodal, me
You can use this whenever you wish to have..
Just use the above two lines in anywhere in your code for displaying the "Loading Form"...
I think you understand my idea...
-Best wishes
Akhilesh
If my post was helpful to you, then express your gratitude using Rate this Post. 
And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet
Social Group: VBForums - Developers from India
Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...
-
Sep 10th, 2008, 08:46 PM
#23
Thread Starter
Fanatic Member
Re: Blinking Letters...
 Originally Posted by koolsid
here is a basic example without the timer and label...modify it as per your requirements...
Code:
Sub aaa()
strg = "loading"
tempstr = " "
For i = 1 To Len(Trim(strg))
MsgBox Replace(strg, Mid(strg, i, 1), tempstr)
Next i
End Sub
I tried this:
Code:
Sub aaa()
strg = "loading"
tempstr = " "
For i = 1 to Len(Trim(strg))
Label1.Caption = Replace(strg, Mid(strg, i, 1), tempstr)
Next i
Timer1.Enabled = False
End Sub
And it only shows "loadin "...
I tried your code and it works on the message box..
I cant' seem to understand what's wrong... Can you help me out again?
Thanks..
Manny Pacquiao once posted in his twitter:
It doesn't matter if the grammar is wrong, what matter is that you get the message
-
Sep 10th, 2008, 08:53 PM
#24
Thread Starter
Fanatic Member
Re: Blinking Letters...
Code:
Dim i As Integer
Private Sub Form_Load()
Timer1.Enabled = False
Timer1.Interval = 1000
End Sub
Private Sub Command1_Click()
Timer1.Enabled = True
i = 8
Timer1_Timer
End Sub
Private Sub Timer1_Timer()
If i = 8 Then
Label1.Caption = " oading"
i = i - 1
ElseIf i = 7 Then
Label1.Caption = "l ading"
i = i - 1
ElseIf i = 6 Then
Label1.Caption = "lo ding"
i = i - 1
ElseIf i = 5 Then
Label1.Caption = "loa ing"
i = i - 1
ElseIf i = 4 Then
Label1.Caption = "load ng"
i = i - 1
ElseIf i = 3 Then
Label1.Caption = "loadi g"
i = i - 1
ElseIf i = 2 Then
Label1.Caption = "loadin "
i = i - 1
ElseIf i = 1 Then
Label1.Caption = "loading"
i = i - 1
Else
Timer1.Enabled = False
Label1.Caption = "loading"
End If
End Sub
This code works perfectly fine but I'm interested with the short one...
Manny Pacquiao once posted in his twitter:
It doesn't matter if the grammar is wrong, what matter is that you get the message
-
Sep 10th, 2008, 11:33 PM
#25
Re: Blinking Letters...
You can try this and see if it suits you. The Sleep API and Pause Sub can be put in a Module if you like. You may want to play with the Pause periods and Timer Intervals that I chose.
Code:
Option Explicit
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Private Sub Form_Load()
Label1.Caption = vbNullString
Timer1.Enabled = False
Timer1.Interval = 300
End Sub
Private Sub Command1_Click()
Timer1.Enabled = True
End Sub
Private Sub Timer1_Timer()
Dim i As Integer
Dim MyWord
Label1.Caption = vbNullString
Pause 0.05
MyWord = Array("L", "o", "a", "d", "i", "n", "g", ".", ".", ".", ".", ".")
For i = 0 To 11
DoEvents
Label1.Caption = Label1.Caption & MyWord(i)
Pause 0.1
Next
End Sub
' Credits: (Milk (Sleep+Pause Sub)).
Public Sub Pause(ByVal Delay As Single)
Delay = Timer + Delay
If Delay > 86400 Then 'more than number of seconds in a day
Delay = Delay - 86400
Do
DoEvents ' to process events.
Sleep 1 ' to not eat cpu
Loop Until Timer < 1
End If
Do
DoEvents ' to process events.
Sleep 1 ' to not eat cpu
Loop While Delay > Timer
End Sub
Last edited by CDRIVE; Sep 10th, 2008 at 11:42 PM.
Reason: Changed Variant 'i' to Integer
<--- Did someone help you? Please rate their post. The little green squares make us feel really smart!
If topic has been resolved, please pull down the Thread Tools & mark it Resolved.
Is VB consuming your life, and is that a bad thing?? 
-
Sep 11th, 2008, 12:02 AM
#26
Re: Blinking Letters...
I discovered that you may want to add this to the code I posted or the program won't end when you close the Form.
Code:
Private Sub Form_Unload(Cancel As Integer)
Timer1.Enabled = False
End Sub
EDIT: Actually, this didn't cure the problem either but it's past 0100 hrs and gotta hit the sack. I'm sure the cure will be apparent over morning coffee.
Last edited by CDRIVE; Sep 11th, 2008 at 12:14 AM.
<--- Did someone help you? Please rate their post. The little green squares make us feel really smart!
If topic has been resolved, please pull down the Thread Tools & mark it Resolved.
Is VB consuming your life, and is that a bad thing?? 
-
Sep 11th, 2008, 12:45 AM
#27
Re: Blinking Letters...
And it only shows "loadin "...
I cant' seem to understand what's wrong... Can you help me out again?
Try this...
Code:
Sub aaa()
strg = "loading..."
tempstr = " "
For i = 1 to Len(Trim(strg))
Label1.Caption = Replace(strg, Mid(strg, i, 1), tempstr)
Next i
Timer1.Enabled = False
End Sub
If my post was helpful to you, then express your gratitude using Rate this Post. 
And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet
Social Group: VBForums - Developers from India
Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...
-
Sep 11th, 2008, 12:49 AM
#28
If my post was helpful to you, then express your gratitude using Rate this Post. 
And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet
Social Group: VBForums - Developers from India
Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...
-
Sep 11th, 2008, 09:02 AM
#29
Re: Blinking Letters...
 Originally Posted by CDRIVE
I discovered that you may want to add this to the code I posted or the program won't end when you close the Form.
Code:
Private Sub Form_Unload(Cancel As Integer)
Timer1.Enabled = False
End Sub
EDIT: Actually, this didn't cure the problem either but it's past 0100 hrs and gotta hit the sack. I'm sure the cure will be apparent over morning coffee. 
I usually avoid using End without arguments but I guess arguments aren't really needed here. This lets the app End when closing the Form. It also works okay in QueryUnload event.
Code:
Private Sub Form_Unload(Cancel As Integer)
End ' user clicked close.
End Sub
Edit: I don't like leaving questionable code behind so I've edited the whole thing and eliminated the End statement. While I'm sure there may be better ways to insure that the app ends when the form is closed, this code does seem to do the job.
Code:
' http://www.vbforums.com/showthread.php?p=3331149#post3331149
Option Explicit
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Dim i As Integer
Private Sub Command1_Click()
Timer1.Enabled = Not Timer1.Enabled = True
End Sub
Private Sub Form_Load()
Label1.Caption = vbNullString
Timer1.Enabled = False
Timer1.Interval = 300
End Sub
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
If Timer1.Enabled <> False Then ' Used to insure that app closes if user
Timer1.Interval = 0 ' closes the form while the Timer sub
Timer1.Enabled = False ' is still executing.
i = 11
Else
Exit Sub
End If
End Sub
Private Sub Timer1_Timer()
Dim MyWord
Label1.Caption = vbNullString
Pause 0.05
MyWord = Array("L", "o", "a", "d", "i", "n", "g", ".", ".", ".", ".", ".")
For i = 0 To 11
DoEvents
Label1.Caption = Label1.Caption & MyWord(i)
Pause 0.1
Next
End Sub
' Credits: (Milk (Sleep+Pause Sub)). (Wayne Spangler (Pause Sub))
Public Sub Pause(ByVal Delay As Single)
Delay = Timer + Delay
If Delay > 86400 Then 'more than number of seconds in a day
Delay = Delay - 86400
Do
DoEvents ' to process events.
Sleep 1 ' to not eat cpu
Loop Until Timer < 1
End If
Do
DoEvents ' to process events.
Sleep 1 ' to not eat cpu
Loop While Delay > Timer
End Sub
Last edited by CDRIVE; Sep 14th, 2008 at 03:24 PM.
Reason: Clean up code.
<--- Did someone help you? Please rate their post. The little green squares make us feel really smart!
If topic has been resolved, please pull down the Thread Tools & mark it Resolved.
Is VB consuming your life, and is that a bad thing?? 
-
Sep 11th, 2008, 09:22 AM
#30
Thread Starter
Fanatic Member
Re: Blinking Letters...
 Originally Posted by akhileshbc
Try this...
Code:
Sub aaa()
strg = "loading..."
tempstr = " "
For i = 1 to Len(Trim(strg))
Label1.Caption = Replace(strg, Mid(strg, i, 1), tempstr)
Next i
Timer1.Enabled = False
End Sub
Already done that.. That's what it only shows this..
"loading.. "
Manny Pacquiao once posted in his twitter:
It doesn't matter if the grammar is wrong, what matter is that you get the message
-
Sep 11th, 2008, 09:24 AM
#31
Thread Starter
Fanatic Member
Re: Blinking Letters...
 Originally Posted by CDRIVE
You can try this and see if it suits you. The Sleep API and Pause Sub can be put in a Module if you like. You may want to play with the Pause periods and Timer Intervals that I chose.
Code:
Option Explicit
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Private Sub Form_Load()
Label1.Caption = vbNullString
Timer1.Enabled = False
Timer1.Interval = 300
End Sub
Private Sub Command1_Click()
Timer1.Enabled = True
End Sub
Private Sub Timer1_Timer()
Dim i As Integer
Dim MyWord
Label1.Caption = vbNullString
Pause 0.05
MyWord = Array("L", "o", "a", "d", "i", "n", "g", ".", ".", ".", ".", ".")
For i = 0 To 11
DoEvents
Label1.Caption = Label1.Caption & MyWord(i)
Pause 0.1
Next
End Sub
' Credits: (Milk (Sleep+Pause Sub)).
Public Sub Pause(ByVal Delay As Single)
Delay = Timer + Delay
If Delay > 86400 Then 'more than number of seconds in a day
Delay = Delay - 86400
Do
DoEvents ' to process events.
Sleep 1 ' to not eat cpu
Loop Until Timer < 1
End If
Do
DoEvents ' to process events.
Sleep 1 ' to not eat cpu
Loop While Delay > Timer
End Sub
I think it's too long.. and too complicated... I'd rather use mine than this one but..
..thanks for the post
Manny Pacquiao once posted in his twitter:
It doesn't matter if the grammar is wrong, what matter is that you get the message
-
Sep 11th, 2008, 09:50 AM
#32
Re: Blinking Letters...
 Originally Posted by louvelle
I think it's too long.. and too complicated... I'd rather use mine than this one but..
..thanks for the post 
You can remove the Pause Sub and use only the Sleep API. In that case you would change all Pause statements to Sleep. I avoid using the Sleep API for all but extremely short periods because no other code will execute during the Sleep periods.
As far as this code being too long and complicated is concerned...?? When you started this thread you were using at least 7 Labels! I think it may be time for you to upgrade your Altair to a machine with a hard drive.
<--- Did someone help you? Please rate their post. The little green squares make us feel really smart!
If topic has been resolved, please pull down the Thread Tools & mark it Resolved.
Is VB consuming your life, and is that a bad thing?? 
-
Sep 12th, 2008, 12:32 AM
#33
If my post was helpful to you, then express your gratitude using Rate this Post. 
And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet
Social Group: VBForums - Developers from India
Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...
-
Sep 12th, 2008, 12:35 AM
#34
Re: Blinking Letters...
Code:
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Private Sub Command1_Click()
For i = 1 To 3
aaa
Next i
End Sub
Sub aaa()
strg = "loading..."
tempstr = " "
For i = 1 To Len(Trim(strg))
Label1.Caption = Replace(strg, Mid(strg, i, 1), tempstr)
Sleep 500
DoEvents
Next i
End Sub
This will show you the effect three times ...
If my post was helpful to you, then express your gratitude using Rate this Post. 
And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet
Social Group: VBForums - Developers from India
Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|