Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Generating a Random Color in Visual Basic .NET
#1
Here is a helpful code snippit that I converted to Visual Basic .NET from Brandon's post in the Java forum.

This function returns a color with random red, green, and blue values.

Pastebin: http://pastebin.com/aS7hxDu5

[code2=vbnet]'This function returns a color with random red, green, and blue values

Function getRandomColor() As Color

Dim random As Random = New Random()
Return Color.FromArgb(random.Next(256), random.Next(256), random.Next(256))

End Function[/code2]
#2
Wow! I can't believe that I did not think to convert it from Java to VB.NET. Thanks!
My Blog | My Setup | My Videos | Have a wonderful day.
#3
How do you convert this codes
Support me by take tour to BPForums http://bit.ly/YTBCS1

Get More Views on youtubehttp://addm.cc/?WIZ01V
#4
brandonio21 Wrote:Wow! I can't believe that I did not think to convert it from Java to VB.NET. Thanks!
No problem!
#5
manishshrestha60 Wrote:How do you convert this codes
I saw Brandon's post about generating a random color in Java, so I looked up how to do it in C#. Then, since I am familiar with Visual Basic .NET and C#, I was able to just change the syntax from C# to Visual Basic .NET.

You can also just use a code converter such as these:
http://www.developerfusion.com/tools/con...arp-to-vb/
http://converter.telerik.com/
#6
Thanks
Support me by take tour to BPForums http://bit.ly/YTBCS1

Get More Views on youtubehttp://addm.cc/?WIZ01V
#7
manishshrestha60 Wrote:Thanks
No problem!


Forum Jump:


Users browsing this thread: 1 Guest(s)