How to rolling dice in visual basic?

Asked By 20 points N/A Posted on -
qa-featured

Hi,

I am working on a project right now. I need to create a game—Snake and Ladder game. Now, I would like to ask how I can roll a dice using VB6. Can you give me an idea on how to code it? Please explain to me what the process is. How to rolling dice in visual basic?

Thanks a lot.

SHARE
Answered By 0 points N/A #168715

How to rolling dice in visual basic?

qa-featured

Hello Elidal Todd,

Following are the detailed steps you need to follow in order to create a six sided dice in Visual Basic: – Create a simple form, just an output label and a button (Roll the Dice). – Name the output label "lbldiceoutput" and the button "btnroll". – Now that you have a simple form, here is the most simplistic code behind the rolling dice application: 1 Public Class frmD6 2 Private Sub btnRoll_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRoll.Click 3 Dim oDice As New Random 4 Dim iDiceResult As Integer = oDice.Next(1, 7) 5 lblDiceOutput.Text = iDiceResult.ToString 6 End Sub 7 End Class

Related Questions