Page 1 of 2 12 LastLast
Results 1 to 15 of 20
  1. #1
    zmansquared's Avatar
    Join Date
    Oct 2008
    Gender
    male
    Location
    Kickin it at Microsoft
    Posts
    2,086
    Reputation
    36
    Thanks
    221
    My Mood
    Cheerful

    Question [Help]Random Color Background[Solved]

    Ok guys i have a timer set to 1000 intervals. and i want my background of form1 to change every 5 mili sec.

    here is my code so far. how do i have it change to next color by itself after 5 mili secs

    [php]Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)
    Handles MyBase.Load
    Timer1.Enabled = True

    Me.BackColor = Color.DarkBlue

    Me.BackColor = Color.Black

    End Sub
    End Class[/php]



    Or what about this. How would i finish

    [php]Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    Dim Color = Me.BackColor

    Select Case Color

    Me.BackColor = Color.DarkBlue

    Me.BackColor = Color.Black

    End Select

    End Sub
    End Class[/php]
    Last edited by zmansquared; 03-17-2010 at 11:03 PM.
    Need Help With Coding or Something??? MSN me
    zmansquared@hotmail.com


    I am the one and only Microsoft Fag!!!

    Quote:
    Originally Posted by Arhk
    All games should be hacked, if we don't do it someone else will. Hackers force the progress, of better programming methods.
    ~


    Take this Pic everyone!



    next-

  2. #2
    Shark23's Avatar
    Join Date
    Mar 2010
    Gender
    male
    Location
    Kansas
    Posts
    424
    Reputation
    10
    Thanks
    55
    My Mood
    Cool
    After some googling I found that it would work if you did:

    Code:
            Me.BackColor = Color.Black
            Me.Refresh()
            System.Threading.Thread.Sleep(50)
            Me.Refresh()
            System.Threading.Thread.Sleep(50)
            Me.BackColor = Color.DarkBlue
            Me.Refresh()
            System.Threading.Thread.Sleep(50)
            Me.BackColor = Color.'Insert Color here

  3. #3
    zmansquared's Avatar
    Join Date
    Oct 2008
    Gender
    male
    Location
    Kickin it at Microsoft
    Posts
    2,086
    Reputation
    36
    Thanks
    221
    My Mood
    Cheerful
    No that doesnt work
    Need Help With Coding or Something??? MSN me
    zmansquared@hotmail.com


    I am the one and only Microsoft Fag!!!

    Quote:
    Originally Posted by Arhk
    All games should be hacked, if we don't do it someone else will. Hackers force the progress, of better programming methods.
    ~


    Take this Pic everyone!



    next-

  4. #4
    Shark23's Avatar
    Join Date
    Mar 2010
    Gender
    male
    Location
    Kansas
    Posts
    424
    Reputation
    10
    Thanks
    55
    My Mood
    Cool
    Does for me. I think it just passes too quickly to see well enough. Better at 10 milliseconds or a delay of 100 instead of 50.

  5. #5
    Obama's Avatar
    Join Date
    Dec 2008
    Gender
    male
    Location
    The Black house
    Posts
    22,195
    Reputation
    870
    Thanks
    6,076
    My Mood
    Cool
    Waiting for nextgen*

  6. #6
    zmansquared's Avatar
    Join Date
    Oct 2008
    Gender
    male
    Location
    Kickin it at Microsoft
    Posts
    2,086
    Reputation
    36
    Thanks
    221
    My Mood
    Cheerful
    copy and paste in your exact code from vb.

    nig ga same here. you code?
    Need Help With Coding or Something??? MSN me
    zmansquared@hotmail.com


    I am the one and only Microsoft Fag!!!

    Quote:
    Originally Posted by Arhk
    All games should be hacked, if we don't do it someone else will. Hackers force the progress, of better programming methods.
    ~


    Take this Pic everyone!



    next-

  7. #7
    Obama's Avatar
    Join Date
    Dec 2008
    Gender
    male
    Location
    The Black house
    Posts
    22,195
    Reputation
    870
    Thanks
    6,076
    My Mood
    Cool
    Quote Originally Posted by zmansquared View Post
    copy and paste in your exact code from vb.

    nig ga same here. you code?
    No, I google

  8. #8
    NextGen1's Avatar
    Join Date
    Dec 2009
    Gender
    male
    Location
    Not sure really.
    Posts
    6,312
    Reputation
    382
    Thanks
    3,019
    My Mood
    Amazed


    Set timer to change at a specific interval

    [php]
    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick

    Dim i As Integer
    i = Rnd() * 3 + 1

    Select Case i

    Case 1
    Me.BackColor = Color.Black
    Case 2
    Me.BackColor = Color.DarkBlue
    Case 3

    'yada yada
    End Select

    End Sub
    [/php]



    Always set I = to rnd * the number of cases you will have
    Last edited by NextGen1; 03-17-2010 at 11:35 PM.


     


     


     



    The Most complete application MPGH will ever offer - 68%




  9. The Following 2 Users Say Thank You to NextGen1 For This Useful Post:

    Obama (03-17-2010),Shark23 (03-17-2010)

  10. #9
    zmansquared's Avatar
    Join Date
    Oct 2008
    Gender
    male
    Location
    Kickin it at Microsoft
    Posts
    2,086
    Reputation
    36
    Thanks
    221
    My Mood
    Cheerful
    haha, that works too.

    have you guys picked a new Ca min?

    i really want to join the new fag agency
    Need Help With Coding or Something??? MSN me
    zmansquared@hotmail.com


    I am the one and only Microsoft Fag!!!

    Quote:
    Originally Posted by Arhk
    All games should be hacked, if we don't do it someone else will. Hackers force the progress, of better programming methods.
    ~


    Take this Pic everyone!



    next-

  11. #10
    Shark23's Avatar
    Join Date
    Mar 2010
    Gender
    male
    Location
    Kansas
    Posts
    424
    Reputation
    10
    Thanks
    55
    My Mood
    Cool
    I have:

    Code:
    Public Class Form1
        Private Sub btnStartDiscoShow_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnStartDiscoShow.Click
            Me.BackColor = Color.Black
            Me.Refresh()
            System.Threading.Thread.Sleep(50)
            Me.Refresh()
            System.Threading.Thread.Sleep(50)
            Me.BackColor = Color.Red
            Me.Refresh()
            System.Threading.Thread.Sleep(50)
            Me.BackColor = Color.Yellow
        End Sub
        Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            Me.BackColor = Color.Black
        End Sub
    End Class
    I'm using black, red, and yellow so I can see them better. Darkblue and black you may not see the change.

    And thanks Nextgen.

    EDIT: Just tested yours out Nextgen and it works quite well. Thanks!
    Last edited by Shark23; 03-17-2010 at 11:33 PM.

  12. #11
    zmansquared's Avatar
    Join Date
    Oct 2008
    Gender
    male
    Location
    Kickin it at Microsoft
    Posts
    2,086
    Reputation
    36
    Thanks
    221
    My Mood
    Cheerful
    hey shark try out this

    Public Class Form1

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    Me.BackColor = Color.Black
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

    Me.BackColor = Color.Black
    Me.Refresh()
    System.Threading.Thread.Sleep(250)
    Me.Refresh()
    System.Threading.Thread.Sleep(250)
    Me.BackColor = Color.Red
    Me.Refresh()
    System.Threading.Thread.Sleep(250)
    Me.BackColor = Color.Yellow
    End Sub

    End Class
    Need Help With Coding or Something??? MSN me
    zmansquared@hotmail.com


    I am the one and only Microsoft Fag!!!

    Quote:
    Originally Posted by Arhk
    All games should be hacked, if we don't do it someone else will. Hackers force the progress, of better programming methods.
    ~


    Take this Pic everyone!



    next-

  13. #12
    NextGen1's Avatar
    Join Date
    Dec 2009
    Gender
    male
    Location
    Not sure really.
    Posts
    6,312
    Reputation
    382
    Thanks
    3,019
    My Mood
    Amazed
    Quote Originally Posted by Shark23 View Post
    I have:

    Code:
    Public Class Form1
        Private Sub btnStartDiscoShow_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnStartDiscoShow.Click
            Me.BackColor = Color.Black
            Me.Refresh()
            System.Threading.Thread.Sleep(50)
            Me.Refresh()
            System.Threading.Thread.Sleep(50)
            Me.BackColor = Color.Red
            Me.Refresh()
            System.Threading.Thread.Sleep(50)
            Me.BackColor = Color.Yellow
        End Sub
        Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            Me.BackColor = Color.Black
        End Sub
    End Class
    I'm using black, red, and yellow so I can see them better. Darkblue and black you may not see the change.

    And thanks Nextgen.

    EDIT: Just tested yours out Nextgen and it works quite well. Thanks!
    Not a problem, and the good news is that method has been around since the beginning of basic, so it is old and trustworthy, plus will work with selecting any random outcome and displaying it.


     


     


     



    The Most complete application MPGH will ever offer - 68%




  14. The Following User Says Thank You to NextGen1 For This Useful Post:

    zmansquared (03-17-2010)

  15. #13
    zmansquared's Avatar
    Join Date
    Oct 2008
    Gender
    male
    Location
    Kickin it at Microsoft
    Posts
    2,086
    Reputation
    36
    Thanks
    221
    My Mood
    Cheerful
    You rock once again
    Need Help With Coding or Something??? MSN me
    zmansquared@hotmail.com


    I am the one and only Microsoft Fag!!!

    Quote:
    Originally Posted by Arhk
    All games should be hacked, if we don't do it someone else will. Hackers force the progress, of better programming methods.
    ~


    Take this Pic everyone!



    next-

  16. #14
    Shark23's Avatar
    Join Date
    Mar 2010
    Gender
    male
    Location
    Kansas
    Posts
    424
    Reputation
    10
    Thanks
    55
    My Mood
    Cool
    Hopefully I can remember that for next time!

    Off topic slightly:
    To zman: Is that all it is or does the project have more?

  17. #15
    zmansquared's Avatar
    Join Date
    Oct 2008
    Gender
    male
    Location
    Kickin it at Microsoft
    Posts
    2,086
    Reputation
    36
    Thanks
    221
    My Mood
    Cheerful
    what do you mean?
    Need Help With Coding or Something??? MSN me
    zmansquared@hotmail.com


    I am the one and only Microsoft Fag!!!

    Quote:
    Originally Posted by Arhk
    All games should be hacked, if we don't do it someone else will. Hackers force the progress, of better programming methods.
    ~


    Take this Pic everyone!



    next-

Page 1 of 2 12 LastLast

Similar Threads

  1. [SOLVED]Help/Release Colors
    By Downie in forum Call of Duty Modern Warfare 2 Help
    Replies: 1
    Last Post: 08-05-2010, 02:10 AM
  2. [Help]Random Number[Solved]
    By tremaster in forum Visual Basic Programming
    Replies: 5
    Last Post: 06-18-2010, 05:43 AM
  3. [Help]BG and FG Color Dialog[Solved]
    By Invidus in forum Visual Basic Programming
    Replies: 7
    Last Post: 03-18-2010, 07:05 AM
  4. [Help]Basic Text Box[Solved]
    By FlashDrive in forum Visual Basic Programming
    Replies: 3
    Last Post: 03-06-2010, 10:54 PM
  5. [Help] random letter
    By noobi4life in forum Visual Basic Programming
    Replies: 4
    Last Post: 11-01-2007, 10:02 AM