This program creates a dice which shows different color on different face. It can be used to play board games when you cannot find a physical dice. It can also be incorporated into VB games that require a dice. Some of the VB games that you can create in Visual Basic are snake chess, monopoly and other board games.
In this program, I use the Randomize function RND to generate random numbers. RND funciton will produce random numbers between 0 and 1. Multiplying RND with 6 will then generate random numbers between 0 and 6 , so 1+RND*6 will produce numbers between 0 and 7, and INT(1+RND*6) will then generate random integers from 1 to 6 because INT is a function that return the integer part of the number. For example, RND=0.4852, 6*RND=2.9112, 1+6*RND=3.9112, so INT(1+6*RND)=INT(3.9112)=3.
To produce different colors, I use the color codes in VB which you can get it from the color palette in the VB properties window. The syntax to assign certain color to an object is object.FillColor=color code.
Color codes in VB take the form of hexadecimal numbers such as HC010F.
By creating shape(n) control array and make them appear according to a generated random number you can then have a perfect virtual dice that is even better than a physical dice!