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

VS 2012 Generate random number and save to array?

$
0
0
ok i have to either be completely missing something or im over thinking this.
im attempting to create a program that will based on user input generate a math problem. not that difficult, but for some reason i can not get it to save the random numbers for use in the math problem

here is the general idea in code
Code:

Private Sub btngen_Click(sender As Object, e As EventArgs) Handles btngen.Click
        Dim Numopp = txtbopor.Text()
        Dim Rangelow = txtblow.Text()
        Dim Rangehigh = txtbmax.Text()
        Dim Passnum = 0
''generate random number based on user imput
              Do
            ''gen ran num save to array
            Randomize()
            Dim value As Integer = CInt(Int((Rangehigh * Rnd()) + Rangelow))
            Passnum = +1
            Exit Do
        Loop Until (Numopp = Passnum)
''type of math problem to generate
        If cbadd.Checked() Then
            ''gen add problem
            '' uncheck other opor boxes
        ElseIf cbsub.Checked() Then
            ''gen sub problem
            '' uncheck other opor boxes
        ElseIf cbmulti.Checked() Then
            ''gen multi problem
            '' uncheck other opor boxes
        ElseIf cbdiv.Checked() Then
            ''gen div problem
            '' uncheck other opor boxes
        ElseIf cbfract.Checked() Then
            ''gen fract problem
            '' uncheck other opor boxes
        End If

        If cbans.Checked() Then
            ''solve generated problem and display answer
        End If

any help is appreciated thanks

VS 2012, win 7 64bit

Viewing all articles
Browse latest Browse all 27203

Trending Articles



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