Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

.NET 

[Source Code] Flashing Text In Visual Basic

Here Is The Code For The Flashing Text In Visual Basic.Hope You Guys Enjoy
-----------------------------------------CODE-------------------------------------------------

Label1.ForeColor = Color.Green
Timer1.Stop()
Timer2.Start()


Label1.ForeColor = Color.Red
Timer2.Stop()
Timer3.Start()


Label1.ForeColor = Color.Yellow
Timer3.Stop()
Timer4.Start()



Label1.ForeColor = Color.Purple
Timer4.Stop()
Timer1.Start()
---------------------------------------------------------------------------------------
Remember Your First Timer Must Be On True Not False.Do This So The Code Works.
PLease use a code/php tag when u are posting a source code bro
(Dec 22, 2014 02:27 AM)Shenagan-Hack-Team Wrote:  Here Is The Code For The Flashing Text In Visual Basic.Hope You Guys Enjoy
------CODE------

Label1.ForeColor = Color.Green
Timer1.Stop()
Timer2.Start()

Label1.ForeColor = Color.Red
Timer2.Stop()
Timer3.Start()

Label1.ForeColor = Color.Yellow
Timer3.Stop()
Timer4.Start()

Label1.ForeColor = Color.Purple
Timer4.Stop()
Timer1.Start()
------
Remember Your First Timer Must Be On True Not False.Do This So The Code Works.
Are you serious? 4 timers for something that easy...❓
Try my simple code:
Code
Public Class Form1

    Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
      Dim Timer1 As New Timer
      AddHandler Timer1.Tick, AddressOf Timer1_Tick
      Timer1.Interval = 100
      Timer1.Start()
    End Sub

    Private Sub Timer1_Tick(sender As Object, e As System.EventArgs)
      Select Case Label1.ForeColor
      Case Color.Green : Label1.ForeColor = Color.Red
      Case Color.Red : Label1.ForeColor = Color.Yellow
      Case Color.Yellow : Label1.ForeColor = Color.Purple
      Case Else : Label1.ForeColor = Color.Green
      End Select
    End Sub

End Class
(Dec 22, 2014 04:10 AM)Haru9 Wrote:  Are you serious? 4 timers for something that easy...❓
Try my simple code:
Code
Public Class Form1

    Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
      Dim Timer1 As New Timer
      AddHandler Timer1.Tick, AddressOf Timer1_Tick
      Timer1.Interval = 100
      Timer1.Start()
    End Sub

    Private Sub Timer1_Tick(sender As Object, e As System.EventArgs)
      Select Case Label1.ForeColor
      Case Color.Green : Label1.ForeColor = Color.Red
      Case Color.Red : Label1.ForeColor = Color.Yellow
      Case Color.Yellow : Label1.ForeColor = Color.Purple
      Case Else : Label1.ForeColor = Color.Green
      End Select
    End Sub

End Class

Thank you for you code :)

Anyone know how to have random color with all colors ?
(Dec 22, 2014 05:11 AM)SIM-2137258 Wrote:  Thank you for you code :)

Anyone know how to have random color with all colors ?

Code
Dim number As New Random : Label1.ForeColor = Color.FromArgb(number.Next(0, 255), number.Next(0, 255), number.Next(0, 255))
🙂
(Dec 22, 2014 05:44 AM)Haru9 Wrote:  
Code
Dim number As New Random : Label1.ForeColor = Color.FromArgb(number.Next(0, 255), number.Next(0, 255), number.Next(0, 255))
🙂

Thank you very much it's nice to share your:)
(Dec 22, 2014 07:37 AM)SIM-2137258 Wrote:  Thank you very much it's nice to share your:)
You're welcome ;)
This is so simple thing...
Anyway, you can find almost everything what you need to know about Visual Basic language here: //msdn.microsoft.com/en-us/library/sh9ywfdk%28v=vs.90%29.aspx 🙂
(Dec 22, 2014 05:11 AM)SIM-2137258 Wrote:  Thank you for you code :)

Anyone know how to have random color with all colors ?

------

Code
Dim NewColor As System.Drawing.Color

Set NewColor variable.

Code
NewColor = Drawing.Color.FromArgb(New Random().Next(0, 255), New Random().Next(0, 255), New Random().Next(0, 255))

Set a new random color.

By using New Random().Next(0,255) you get a random number between 0 and 255. You use it 3 times to get an RGB color, and convert it to System.Drawing.Color by using System.Drawing.Color.FromArgb.

Example in use:
Code
Public Class Form1

    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
      Dim NewColor As System.Drawing.Color

      NewColor = Drawing.Color.FromArgb(New Random().Next(0, 255), New Random().Next(0, 255), New Random().Next(0, 255))
      Me.BackColor = NewColor
    End Sub
End Class

In case of Haru9's code, you should do:
Code
Private Sub Timer1_Tick(sender As Object, e As System.EventArgs)
      NewColor = Drawing.Color.FromArgb(New Random().Next(0, 255), New Random().Next(0, 255), New Random().Next(0, 255))
      Label1.ForeColor = NewColor
    End Sub
(Dec 22, 2014 10:03 AM)RandomUser123 Wrote:  
Code
NewColor = Drawing.Color.FromArgb(New Random().Next(0, 255), New Random().Next(0, 255), New Random().Next(0, 255))

Why are you creating 3 Random instances for that?
you could make a new class then inherit the label control, do some stuff with the Ondraw sub, it saves your form from having messy code with all the timers
(Dec 22, 2014 10:36 AM)Odus Wrote:  Why are you creating 3 Random instances for that?

Because you need 3 values to make an RGB color (red value, green value and blue value). FromArgb(red, green, blue).
(Dec 22, 2014 12:14 PM)RandomUser123 Wrote:  Because you need 3 values to make an RGB color (red value, green value and blue value). FromArgb(red, green, blue).

Yes I'm well aware FromArgb takes 3 arguments but you're initializing a new random for each argument, you only need 1 and it's using unnecessary memory. Plus your code only returns greyscale when I use it. Try this:

Code
Dim R As Random = New Random()
      Me.BackColor = Drawing.Color.FromArgb(R.Next(0, 255), R.Next(0, 255), R.Next(0, 255))
(Dec 22, 2014 12:26 PM)Odus Wrote:  Yes I'm well aware FromArgb takes 3 arguments but you're initializing a new random for each argument, you only need 1 and it's using unnecessary memory. Plus your code only returns greyscale when I use it. Try this:

Code
Dim R As Random = New Random()
      Me.BackColor = Drawing.Color.FromArgb(R.Next(0, 255), R.Next(0, 255), R.Next(0, 255))

Use this, OP.

However, you should declare your random in the class scope.
There's no need to declare a new variable every time a method is executed.
Doesnt a variable get deleted from RAM after a method stops using it?
I thought so, for this i was using 3...

Btw i had to add another value, because first one is aplha (transparency) then rgb.
By manually setting rgb values (and alpha at 255) i can get red blue and green. By doing it using random function i get greyscale... o.o

EDIT-----
Fixed so:
Code
Dim NewColor As System.Drawing.Color
      Dim Random As New Random
      NewColor = Drawing.Color.FromArgb(255, Random.Next(0, 255), Random.Next(0, 255), Random.Next(0, 255))
      Label1.ForeColor = NewColor

By using New Random().Next(0,255) I get grey scale. By declaring the variabile I don't. Is there a reason?
(Dec 22, 2014 03:13 PM)RandomUser123 Wrote:  Doesnt a variable get deleted from RAM after a method stops using it?
I thought so, for this i was using 3...
Yes, but it consumes memory when this code part is executed, that generally means slow-down for your application... More variables = more memory.

(Dec 22, 2014 03:13 PM)RandomUser123 Wrote:  Btw i had to add another value, because first one is aplha (transparency) then rgb.
By manually setting rgb values (and alpha at 255) i can get red blue and green. By doing it using random function i get greyscale... o.o
Alpha color is optional. If you don't want to set transparency of rgb value, you don't need to define it, it is always 255 by default.

(Dec 22, 2014 03:13 PM)RandomUser123 Wrote:  By using New Random().Next(0,255) I get grey scale. By declaring the variabile I don't. Is there a reason?
Yes, you propably don't know what you are doing at all.
//msdn.microsoft.com/en-us/library/system.random(v=vs.110).aspx
Quote:Random Class
Represents a pseudo-random number generator, which is a device that produces a sequence of numbers that meet certain statistical requirements for randomness.
...
If the same seed is used for separate Random objects, they will generate the same series of random numbers.
...



Possibly Related Threads...
Thread / Author Replies Views Last Post
[Source] by SIM-5420967May 26, 2024 09:50 AM 2 371 May 26, 2024 09:50 AM
Last Post: xiaowanga8
[.NET] by VisualSoftNov 6, 2023 05:12 PM 125 7,611 Nov 6, 2023 05:12 PM
Last Post: Hopsin
[.NET] by BladabindiMay 17, 2023 12:20 AM 1 178 May 17, 2023 12:20 AM
Last Post: NyQuil