L
Leon
I have a webform in which when the user press generate button the form
generate six unique ramdon numbers, the user can also type these six numbers
in manually in any order. however, the user can also press a post button
that post these six numbers into the database. My problem is that these six
numbers need to be posted to the database from less to greatest, and all of
my code is within the business tier class not the code behind class.
After looking at my code below...
How do I create an ArrayList that can get the values from the Generate
function ("which include a stack") and pass to the form, and get the values
from the form and pass them to the database? **Please note where you see is
my problem. Thanks
Private Function Generate(ByVal Value As Integer) As Integer
Dim arrl(Value) As Integer
Dim x As Integer
Dim j As Integer
Dim s As Stack = New Stack
Dim blnexists As Boolean = True
For j = 0 To Value
arr1(j) = GetRandomNumber()
blnexists = s.Contains(arr1(j))
While blnexists = True
arr1(j) = GetRandomNumber()
blnexists = s.Contains(arr1(j))
End While
s.Push(arr1(j))
Next
For x = 0 To Value
arr1(x) = s.Pop()
Next
'Just Tried something did not work
'Dim I As Integer
'Dim pickNums As ArrayList = New ArrayList
'For I = 0 To PickCount
'pickNums.Add(arrl(I))
'Next
'GeneratePick = SortPick(pickNums)
End Function
'Just Tried something did not work
'Public Function SortPick(ByVal UserPick As ArrayList)
'UserPick.Sort()
'End Function
generate six unique ramdon numbers, the user can also type these six numbers
in manually in any order. however, the user can also press a post button
that post these six numbers into the database. My problem is that these six
numbers need to be posted to the database from less to greatest, and all of
my code is within the business tier class not the code behind class.
After looking at my code below...
How do I create an ArrayList that can get the values from the Generate
function ("which include a stack") and pass to the form, and get the values
from the form and pass them to the database? **Please note where you see is
my problem. Thanks
Private Function Generate(ByVal Value As Integer) As Integer
Dim arrl(Value) As Integer
Dim x As Integer
Dim j As Integer
Dim s As Stack = New Stack
Dim blnexists As Boolean = True
For j = 0 To Value
arr1(j) = GetRandomNumber()
blnexists = s.Contains(arr1(j))
While blnexists = True
arr1(j) = GetRandomNumber()
blnexists = s.Contains(arr1(j))
End While
s.Push(arr1(j))
Next
For x = 0 To Value
arr1(x) = s.Pop()
Next
'Just Tried something did not work
'Dim I As Integer
'Dim pickNums As ArrayList = New ArrayList
'For I = 0 To PickCount
'pickNums.Add(arrl(I))
'Next
'GeneratePick = SortPick(pickNums)
End Function
'Just Tried something did not work
'Public Function SortPick(ByVal UserPick As ArrayList)
'UserPick.Sort()
'End Function