Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27071

[RESOLVED] trying to get the smallest number from an array always return "0"

$
0
0
I am writing a dice roller program with VB 2010 express that rolls many different types of dice and up to 15 of each type. I currently have 4 options on for the program. Choose how many dice, Choose how many sides on dice, Choose only the highest roll and choose only the lowest roll. Everything seems to be working as intended with the exception of the "Use lowest Die" code. If anyone can please point me into the right direction or give me an example of how to do it better. Thanks in advance for any help

Code:

        Dim DiceArray(frmRoller.cmbNumberofdice.Text) As Long
        Dim iTemp As Integer
        Dim i As Integer
        Dim numofDice As Integer
        Dim CountArrayHigh(100) As Integer
        Dim CountArrayLow(100) As Integer
        numofDice = frmRoller.cmbNumberofdice.Text

        Select Case frmRoller.cmbChooseDie.Text
            Case "D4"
                For i = 1 To numofDice
                    iTemp = D4()
                    DiceArray(i) = iTemp
                    If iTemp > CountArrayHigh(0) Then CountArrayHigh(0) = iTemp
                    If iTemp < CountArrayLow(0) Then CountArrayLow(0) = iTemp

                Next i

                highDie = CountArrayHigh(0)
                lowDie = CountArrayLow(0)


Viewing all articles
Browse latest Browse all 27071

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>