[Tutorial]How to make a Form1 Caption Changer

Posts 1–15 of 18 · Page 1 of 2
[Tutorial]How to make a Form1 Caption Changer
VISUAL BASIC 6 Compatible

Add Allot of Timers, I used 15 for a WebBrowser.
Change the Form caption to 0
change the timers to 500, and disable all of them except 1 timer (The first timer)

The code is:
Code:
Private Sub Timer1_Timer()
Form1.Caption = "W|"
Timer1.Enabled = False
Timer2.Enabled = True
End Sub

Private Sub Timer10_Timer()
Form1.Caption = "WebBrowser"
Timer10.Enabled = False
Timer11.Enabled = True
End Sub

Private Sub Timer11_Timer()
Form1.Caption = "WebBrowser|"
Timer11.Enabled = False
Timer12.Enabled = True
End Sub

Private Sub Timer12_Timer()
Form1.Caption = "WebBrowser"
Timer12.Enabled = False
Timer13.Enabled = True
End Sub

Private Sub Timer13_Timer()
Form1.Caption = "WebBrowser|"
Timer13.Enabled = False
Timer14.Enabled = True
End Sub

Private Sub Timer14_Timer()
Form1.Caption = "WebBrowser"
Timer14.Enabled = False
Timer15.Enabled = True
End Sub

Private Sub Timer15_Timer()
Form1.Caption = ""
Timer15.Enabled = False
Timer1.Enabled = True
End Sub

Private Sub Timer2_Timer()
Form1.Caption = "We"
Timer2.Enabled = False
Timer3.Enabled = True
End Sub

Private Sub Timer3_Timer()
Form1.Caption = "Web|"
Timer3.Enabled = False
Timer4.Enabled = True
End Sub

Private Sub Timer4_Timer()
Form1.Caption = "WebB"
Timer4.Enabled = False
Timer5.Enabled = True
End Sub

Private Sub Timer5_Timer()
Form1.Caption = "WebBr|"
Timer5.Enabled = False
Timer6.Enabled = True
End Sub

Private Sub Timer6_Timer()
Form1.Caption = "WebBro"
Timer6.Enabled = False
Timer7.Enabled = True
End Sub

Private Sub Timer7_Timer()
Form1.Caption = "WebBrow|"
Timer7.Enabled = False
Timer8.Enabled = True
End Sub

Private Sub Timer8_Timer()
Form1.Caption = "WebBrows"
Timer8.Enabled = False
Timer9.Enabled = True
End Sub

Private Sub Timer9_Timer()
Form1.Caption = "WebBrowse|"
Timer9.Enabled = False
Timer10.Enabled = True
End Sub
So yea, Enjoy!
That is probably the stupidest way i've ever seen to do that. 15 timers...my god.

Add this to a background worker so it doesn't lagg the UI thread and it's all you need:

[php]
Me.Text = ""
CheckForIllegalCrossThreadCalls = False
Dim myCaption As String = "Jason is awesome!"
For i as integer = 0 to myCaption.Length -1
Me.Text &= myCaption(i)
Threading.Thread.Sleep(500)
Next
[/php]

Or alternatively:
[php]
CheckForIllegalCrossThreadCalls = False
Dim myCaption As String = "Jason is awesome!"
For i as integer = 0 to myCaption.Length
Me.Text = myCaption.Substring(0, i)
Threading.Thread.Sleep(500)
Next
[/php]
Code:
CheckForIllegalCrossThreadCalls = False
Dim myCaption As String = "Jason is awesome!"
For i as integer = 0 to myCaption.Length
      Me.Text = myCaption.Substring(0, i)
      Threading.Thread.Sleep (500)
Next
Neither am I, but when you start having to make a timer to write each letter of a predefined word...don't you start thinking there could be an easier way?
2 errors

Code:
Dim myCaption As String = "Jason is awesome!"
For i as integer = 0 to myCaption.Length
Quote Originally Posted by o0OpurezO0o View Post
2 errors

Code:
Dim myCaption As String = "Jason is awesome!"
For i as integer = 0 to myCaption.Length
I take it you're using VB6? It's time to move on mate.
i aint moving from VB6, its the easiest programmer i know (Except VB8)
Quote Originally Posted by o0OpurezO0o View Post
i aint moving from VB6, its the easiest programmer i know (Except VB8)
I meant move to .NET...without the .NET framework in VB6 you're sacrificing a lot just to live in the past. Download VB.NET 2008 express edition from microsoft and start there. You can't say that it's worse than VB6 when I just condensed your 15 timers into about 6 lines of code.
@ Tut .............................
@ OP - Tut Section
um, is that a trick site? VB.NET just takes me to a gay site in the netherlands.
I have VB8 Express Edition CRACKED already. BTW i wasnt googling, i went to the website.
You don't need to crack the free version of Visual Basic .NET...

Bleh I'm moving to tuts section.
Quote Originally Posted by Lolland View Post
You don't need to crack the free version of Visual Basic .NET...

Bleh I'm moving to tuts section.
Now it'll be forgotten in < 5 minutes. God I hate this section.
@ Jason, There is a reason for the tutorials section.

A Link should be added to the vb.net tutorial list. Everyone should do their best to build up this section as opposed to worrying about the tutorial section.

Here is essentially how this will work out.

Everyone who is looking for a tut will eventually get used to going to the tut section, everyone who can't figure out a tut or vb question , will essentially come here to ask fo help. That will create a circle (rotation) increasing traffic to both VB section and Tutorial section.

Releases in the VB section will increase traffic to VB section. Questions and comments will keep the section alive.

If members focus on game apps and hacks and release them in other sections (appropriate) it will draw attention here as well.

It's a matter of increasing programming section.

If a section dies, we may have to worry about being sub categorized. Best to build the section

Plus, essentially, is the tut worth attention?



Posts 1–15 of 18 · Page 1 of 2

Post a Reply

Similar Threads

Tags for this Thread

None

Talk with us