Results 1 to 6 of 6

Thread: [Resolved]two random Numbers

Threaded View

  1. #1

    Thread Starter
    Member rockyamyx's Avatar
    Join Date
    Nov 2010
    Posts
    62

    Resolved [Resolved]two random Numbers

    every time i press the Roll Dice button the turn1roll1, turn1roll2, or turn2roll1, turn2roll2(depending on turn variable) it shows system.random

    in ASCII Chart i used the label names so no confusion ^^





    _________________________________
    | turn1roll1 | turn1roll2 | turn1sum |
    | turn2roll1 | turn2roll2 | turn2sum |
    | |
    | |
    | |
    | |
    | |
    | |
    | |
    | [RollDice] |
    | |
    | |
    __________________________________





    Code:
    Public Class Form1
        Dim turn = 1
    
    
    
        Private Sub RollDice_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Dice.Click
    
            Dim die1 As New Random
            Dim die2 As New Random
            Dim roll As Integer = die1.Next(1, 7) + die2.Next(1, 7)
    
    
            If turn = 1 Then
                turn1roll1.Text = die1.ToString
                turn1roll2.Text = die2.ToString
                turn1sum.Text = roll.ToString
                turn = turn + 1
            ElseIf turn = 2 Then
                Dim roll2 As Integer = die1.Next(1, 7) + die2.Next(1, 7)
                turn2roll1.Text = die1.ToString
                turn2roll2.Text = die2.ToString
                turn2sum.Text = roll2.ToString
                turn = turn - 1
            End If
    
    
    
        End Sub
    Last edited by rockyamyx; Nov 26th, 2010 at 09:00 AM. Reason: Resolved

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width