Skip to content
MPGHThe Dark Arts
/
RegisterLog in
Forum
Community
What's NewLatest posts across the boardTrendingHottest threads right nowSubscribedThreads you follow
Discussion
GeneralIntroductionsEntertainmentDebate FortFlaming & Rage
Board
News & AnnouncementsMPGH TimesSuggestions & HelpGiveaways
More Sections
Art & Graphic DesignProgrammingHackingCryptocurrency
Hacks & Cheats
Games
ValorantCS2 / CS:GOCall of Duty / WarzoneFortniteApex LegendsEscape From Tarkov
+14 moreLeague of LegendsGTA VMinecraftRustROTMGBattlefieldTroveBattleOnCombat ArmsCrossFireBlackshotRuneScapeDayZDead by Daylight
Resources
Game Hacking TutorialsReverse EngineeringGeneral Game HackingAnti-CheatConsole Game Hacking
Tools
Game Hacking ToolsTrainers & CheatsHack/Release NewsNew
Submit a release →Share your cheat, tool, or config with the community.
AINEW
AI Tools
General & DiscussionPrompt EngineeringLLM JailbreaksHotAI Agents & AutomationLocal / Open Models
AI × Gaming
AI Aimbots & VisionML Anti-CheatGame Bots & Automation
Create
AI Coding / Vibe CodingAI Art & MediaAI Voice & TTS
The AI frontier →Where game hacking meets modern machine learning. Jump in.
Marketplace
Buy & Sell
SellingBuyingTradingUser Services
Trust & Safety
Middleman LoungeMarketplace TalkVouch Copy Profiles
Money
Cryptocurrency TalkCurrency ExchangeWork & Job Offers
Start selling →List accounts, services, and goods. Use the middleman to trade safe.
MPGH The Dark Arts

A community for offensive security research, reverse engineering, and AI.

Community

ForumMarketplaceSearch

Account

RegisterLog in

Legal

Privacy PolicyForum RulesHelp & FAQ
© 2026 MPGH · All rights reserved.Built by the community, for the community. For educational purposes onlyContent is shared for security research and education — we don't condone illegal use. You're responsible for complying with applicable laws. Use at your own risk.
Home › Forum › Programming › Visual Basic Programming › [Help]Random Color Background[Solved]

Question[Help]Random Color Background[Solved]

Posts 1–15 of 20 · Page 1 of 2
zmansquared
zmansquared
[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]
#1 · edited 16y ago · 16y ago
Shark23
Shark23
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
#2 · 16y ago
zmansquared
zmansquared
No that doesnt work
#3 · 16y ago
Shark23
Shark23
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.
#4 · 16y ago
Obama
Obama
Waiting for nextgen*
#5 · 16y ago
zmansquared
zmansquared
copy and paste in your exact code from vb.

nig ga same here. you code?
#6 · 16y ago
Obama
Obama
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
#7 · 16y ago
NextGen1
NextGen1


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
#8 · edited 16y ago · 16y ago
zmansquared
zmansquared
haha, that works too.

have you guys picked a new Ca min?

i really want to join the new fag agency
#9 · 16y ago
Shark23
Shark23
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!
#10 · edited 16y ago · 16y ago
zmansquared
zmansquared
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
#11 · 16y ago
NextGen1
NextGen1
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.
#12 · 16y ago
zmansquared
zmansquared
You rock once again
#13 · 16y ago
Shark23
Shark23
Hopefully I can remember that for next time!

Off topic slightly:
To zman: Is that all it is or does the project have more?
#14 · 16y ago
zmansquared
zmansquared
what do you mean?
#15 · 16y ago
Posts 1–15 of 20 · Page 1 of 2

Post a Reply

Similar Threads

  • [Help]BG and FG Color Dialog[Solved]By Invidus in Visual Basic Programming
    7Last post 16y ago
  • [Help]Random Number[Solved]By tremaster in Visual Basic Programming
    5Last post 16y ago
  • [SOLVED]Help/Release ColorsBy Downie in Call of Duty Modern Warfare 2 Help
    1Last post 16y ago
  • [Help]Basic Text Box[Solved]By FlashDrive in Visual Basic Programming
    3Last post 16y ago
  • [Help] random letterBy noobi4life in Visual Basic Programming
    4Last post 18y ago

Tags for this Thread

None