Forum guidelines
  • Home
  • »
  • How do I
  • »
  • Using Random function with "do...until" in VB.NET
Using Random function with "do...until" in VB.NET
Posted By C M on 22 Nov 2012
I have to write a small program which will roll 2 dice until both display a 1.  Both numbers rolled each time must also be displayed in a list box.
I have this so far:


        Dim iDice1 As Integer
        Dim iDice2 As Integer


        Do Until iDice1 = 1 And iDice2 = 1
            iDice1 = (Rnd() * 5) + 1
            iDice2 = (Rnd() * 5) + 1
            lboDiceRolls.Items.Add(iDice1 & iDice2)
 End Sub

It isn't displaying anything, and I have tried many different versions of the above statement using different combinations of things.  I know I'm probably missing something really dumb, but I'm very new to using VB so I'm not sure if I'm on the right track.

Infragistics jQuery Controls


Spire.Doc - Free .NET Word API
Use Spire.Doc to create, read, write, print, and convert word documents to OpenXML, RTF, TXT, XPS, EPUB, EMF, HTML, Image and PDF.