Velocity Reviews > ArrayList Function In Business Tier?

# ArrayList Function In Business Tier?

Leon
Guest
Posts: n/a

 11-25-2004
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

'Next

'GeneratePick = SortPick(pickNums)

End Function

'Just Tried something did not work

'Public Function SortPick(ByVal UserPick As ArrayList)

'UserPick.Sort()

'End Function

mortb
Guest
Posts: n/a

 11-26-2004
Not sure what you want to do but here is a function that returns a sorted
stack of numberOfNumbers random numbers
cheers,
mortb

Private Function Generate(ByVal numberOfNumbers As Integer) As Stack
Dim al as ArrayList = new ArrayList(numberOfNumbers)
Dim rand as random = new Random()
for i as integer = 0 to numberOfNumbers
Dim rnd as integer = rand.Next()
while(al.Contains(rnd))
rnd = rand.Next()
end while
next
al.Sort()
Generate = new Stack(al)
End Function

pseudo code:

stack = generate
textbox1 = (stack.pop)ToString()
textbox2 = (stack.pop)ToString()
..

end function

"Leon" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>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
>
>
> 'Next
>
> 'GeneratePick = SortPick(pickNums)
>
>
> End Function
>
>
>
> 'Just Tried something did not work
>
> 'Public Function SortPick(ByVal UserPick As ArrayList)
>
> 'UserPick.Sort()
>
> 'End Function
>
>
>

mortb
Guest
Posts: n/a

 11-26-2004
oops,
when the elements are added to the stack they are reversed to avoid this
insert
al.Reverse()
before
Generate = new Stack(al)

cheers,
mortb

"mortb" <mortb1<noospam<@hotmail.com> wrote in message
news:(E-Mail Removed)...
> Not sure what you want to do but here is a function that returns a sorted
> stack of numberOfNumbers random numbers
> cheers,
> mortb
>
> Private Function Generate(ByVal numberOfNumbers As Integer) As Stack
> Dim al as ArrayList = new ArrayList(numberOfNumbers)
> Dim rand as random = new Random()
> for i as integer = 0 to numberOfNumbers
> Dim rnd as integer = rand.Next()
> while(al.Contains(rnd))
> rnd = rand.Next()
> end while
> next
> al.Sort()
> Generate = new Stack(al)
> End Function
>
> pseudo code:
>
> stack = generate
> textbox1 = (stack.pop)ToString()
> textbox2 = (stack.pop)ToString()
> ..
>
> end function
>
>
>
> "Leon" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>>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
>>
>>
>> 'Next
>>
>> 'GeneratePick = SortPick(pickNums)
>>
>>
>> End Function
>>
>>
>>
>> 'Just Tried something did not work
>>
>> 'Public Function SortPick(ByVal UserPick As ArrayList)
>>
>> 'UserPick.Sort()
>>
>> 'End Function
>>
>>
>>

>
>

Leon
Guest
Posts: n/a

 11-26-2004
Thanks for your reply, but what I want to do is pass the randomly generated
numbers from the Generate function which is in the business tier to my
webform.
Do I need to declare the Generate function as a ArrayList or build a
separate ArrayList function or sub and pass the values from there to my
page?
OR....
How do I get the five generated number from this class which is in the
See Code...
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
End Function

"mortb" <mortb1<noospam<@hotmail.com> wrote in message
news:(E-Mail Removed)...
> oops,
> when the elements are added to the stack they are reversed to avoid this
> insert
> al.Reverse()
> before
> Generate = new Stack(al)
>
> cheers,
> mortb
>
> "mortb" <mortb1<noospam<@hotmail.com> wrote in message
> news:(E-Mail Removed)...
>> Not sure what you want to do but here is a function that returns a sorted
>> stack of numberOfNumbers random numbers
>> cheers,
>> mortb
>>
>> Private Function Generate(ByVal numberOfNumbers As Integer) As Stack
>> Dim al as ArrayList = new ArrayList(numberOfNumbers)
>> Dim rand as random = new Random()
>> for i as integer = 0 to numberOfNumbers
>> Dim rnd as integer = rand.Next()
>> while(al.Contains(rnd))
>> rnd = rand.Next()
>> end while
>> next
>> al.Sort()
>> Generate = new Stack(al)
>> End Function
>>
>> pseudo code:
>>
>> stack = generate
>> textbox1 = (stack.pop)ToString()
>> textbox2 = (stack.pop)ToString()
>> ..
>>
>> end function
>>
>>
>>
>> "Leon" <(E-Mail Removed)> wrote in message
>> news:(E-Mail Removed)...
>>>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
>>>
>>>
>>> 'Next
>>>
>>> 'GeneratePick = SortPick(pickNums)
>>>
>>>
>>> End Function
>>>
>>>
>>>
>>> 'Just Tried something did not work
>>>
>>> 'Public Function SortPick(ByVal UserPick As ArrayList)
>>>
>>> 'UserPick.Sort()
>>>
>>> 'End Function
>>>
>>>
>>>

>>
>>

>
>

mortb
Guest
Posts: n/a

 11-26-2004
Like this (pseudo code not compiled)?
Page code behind:

submit onclick:

Dim userRandomNumbers as ArrayList = new ArrayList()
if userRnd1.Text.Trim() != ""
are text fields for the random numbers
end if
if userRnd2.Text.Trim() != ""
end if
....

' if the generate would return an arraylist of x random numbers:
int x = 6 - userRandomNumbers.Count
userRandomNumbers.Sort()

'if you want to display the resulting numbers on your webform:
userRnd1.Text.= userRandomNumbers[0]
userRnd2.Text.= userRandomNumbers[1]
....

' code that post data to database goes here...

"Leon" <(E-Mail Removed)> wrote in message
news:O%(E-Mail Removed)...
> Thanks for your reply, but what I want to do is pass the randomly
> generated numbers from the Generate function which is in the business tier
> to my webform.
> Do I need to declare the Generate function as a ArrayList or build a
> separate ArrayList function or sub and pass the values from there to my
> page?
> OR....
> How do I get the five generated number from this class which is in the
> business tier to my webform?

Leon
Guest
Posts: n/a

 11-26-2004
Thanks For all the help, but this is my code and it runs but it only return
one value to the textbox and I know the other values exist because I step
inside of my code. what do you see that I'm doing wrong. thanks again!!!

Private Function Generate(ByVal Value As Integer) As ArrayList
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
Dim I As Integer
Dim UserNum As ArrayList = New ArrayList
For I = 0 To Value
Next
Generate= New ArrayList(UserNum)
End Function

And then this code is in my code behind class...............

Dim test As ArrayList
test = newPick.GeneratePick(5)

Me.TextBox1.Text = test.Item(0)
Me.TextBox1.Text = test.Item(1)
Me.TextBox1.Text = test.Item(2)
Me.TextBox1.Text = test.Item(3)
Me.TextBox1.Text = test.Item(4)
Me.TextBox1.Text = test.Item(5)

"mortb" <mortb1<noospam<@hotmail.com> wrote in message
news:(E-Mail Removed)...
> Like this (pseudo code not compiled)?
> Page code behind:
>
> submit onclick:
>
> Dim userRandomNumbers as ArrayList = new ArrayList()
> if userRnd1.Text.Trim() != ""
> userRandomNumbers.Add(int.Parse(userRnd1.Text.Trim ())) ' Assuming there
> are text fields for the random numbers
> end if
> if userRnd2.Text.Trim() != ""
> end if
> ...
>
> ' if the generate would return an arraylist of x random numbers:
> int x = 6 - userRandomNumbers.Count
> userRandomNumbers.Sort()
>
> 'if you want to display the resulting numbers on your webform:
> userRnd1.Text.= userRandomNumbers[0]
> userRnd2.Text.= userRandomNumbers[1]
> ...
>
> ' code that post data to database goes here...
>
> "Leon" <(E-Mail Removed)> wrote in message
> news:O%(E-Mail Removed)...
>> Thanks for your reply, but what I want to do is pass the randomly
>> generated numbers from the Generate function which is in the business
>> tier to my webform.
>> Do I need to declare the Generate function as a ArrayList or build a
>> separate ArrayList function or sub and pass the values from there to my
>> page?
>> OR....
>> How do I get the five generated number from this class which is in the
>> business tier to my webform?

>
>

mortb
Guest
Posts: n/a

 11-26-2004
If the numbers are there when you step into the code then the problem has to
be somwhere else -- somewhere in the code that you haven't posted.

By the way, why do you create a stack? and an array? It seems you only need
the array list which you return...

cheers,
mortb

Private Function Generate(ByVal Value As Integer) As ArrayList
Dim arrl As ArrayList(Value)
For j = 0 To Value
Dim rnd as integer = GetRandomNumber()
While arrl.Contains(rnd)
rnd = GetRandomNumber()
End While
Next
Generate = arrl
End Function

"Leon" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Thanks For all the help, but this is my code and it runs but it only
> return one value to the textbox and I know the other values exist because
> I step inside of my code. what do you see that I'm doing wrong. thanks
> again!!!
>
> Private Function Generate(ByVal Value As Integer) As ArrayList
> 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
> Dim I As Integer
> Dim UserNum As ArrayList = New ArrayList
> For I = 0 To Value
> Next
> Generate= New ArrayList(UserNum)
> End Function
>
> And then this code is in my code behind class...............
>
> Dim test As ArrayList
> test = newPick.GeneratePick(5)
>
> Me.TextBox1.Text = test.Item(0)
> Me.TextBox1.Text = test.Item(1)
> Me.TextBox1.Text = test.Item(2)
> Me.TextBox1.Text = test.Item(3)
> Me.TextBox1.Text = test.Item(4)
> Me.TextBox1.Text = test.Item(5)
>
> "mortb" <mortb1<noospam<@hotmail.com> wrote in message
> news:(E-Mail Removed)...
>> Like this (pseudo code not compiled)?
>> Page code behind:
>>
>> submit onclick:
>>
>> Dim userRandomNumbers as ArrayList = new ArrayList()
>> if userRnd1.Text.Trim() != ""
>> there are text fields for the random numbers
>> end if
>> if userRnd2.Text.Trim() != ""
>> end if
>> ...
>>
>> ' if the generate would return an arraylist of x random numbers:
>> int x = 6 - userRandomNumbers.Count
>> userRandomNumbers.Sort()
>>
>> 'if you want to display the resulting numbers on your webform:
>> userRnd1.Text.= userRandomNumbers[0]
>> userRnd2.Text.= userRandomNumbers[1]
>> ...
>>
>> ' code that post data to database goes here...
>>
>> "Leon" <(E-Mail Removed)> wrote in message
>> news:O%(E-Mail Removed)...
>>> Thanks for your reply, but what I want to do is pass the randomly
>>> generated numbers from the Generate function which is in the business
>>> tier to my webform.
>>> Do I need to declare the Generate function as a ArrayList or build a
>>> separate ArrayList function or sub and pass the values from there to my
>>> page?
>>> OR....
>>> How do I get the five generated number from this class which is in the
>>> business tier to my webform?

>>
>>

>
>

Leon
Guest
Posts: n/a

 11-26-2004
I use the stack just to make sure I get 5 unique random number back.
however, what I sent was all the code and what I meant by say "the number
are there when I step into my project is the numbers are in the stack, but
it only sends one value back to the calling function ArrayList. maybe I can
change the stack to ArrayList but my biggest problem is getting from the
Generate Function ArrayList to my textboxes in my webform on button click.

"mortb" <mortb1<noospam<@hotmail.com> wrote in message
news:(E-Mail Removed)...
> If the numbers are there when you step into the code then the problem has
> to be somwhere else -- somewhere in the code that you haven't posted.
>
> By the way, why do you create a stack? and an array? It seems you only
> need the array list which you return...
>
> cheers,
> mortb
>
> Private Function Generate(ByVal Value As Integer) As ArrayList
> Dim arrl As ArrayList(Value)
> For j = 0 To Value
> Dim rnd as integer = GetRandomNumber()
> While arrl.Contains(rnd)
> rnd = GetRandomNumber()
> End While
> Next
> Generate = arrl
> End Function
>
>
> "Leon" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> Thanks For all the help, but this is my code and it runs but it only
>> return one value to the textbox and I know the other values exist because
>> I step inside of my code. what do you see that I'm doing wrong. thanks
>> again!!!
>>
>> Private Function Generate(ByVal Value As Integer) As ArrayList
>> 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
>> Dim I As Integer
>> Dim UserNum As ArrayList = New ArrayList
>> For I = 0 To Value
>> Next
>> Generate= New ArrayList(UserNum)
>> End Function
>>
>> And then this code is in my code behind class...............
>>
>> Dim test As ArrayList
>> test = newPick.GeneratePick(5)
>>
>> Me.TextBox1.Text = test.Item(0)
>> Me.TextBox1.Text = test.Item(1)
>> Me.TextBox1.Text = test.Item(2)
>> Me.TextBox1.Text = test.Item(3)
>> Me.TextBox1.Text = test.Item(4)
>> Me.TextBox1.Text = test.Item(5)
>>
>> "mortb" <mortb1<noospam<@hotmail.com> wrote in message
>> news:(E-Mail Removed)...
>>> Like this (pseudo code not compiled)?
>>> Page code behind:
>>>
>>> submit onclick:
>>>
>>> Dim userRandomNumbers as ArrayList = new ArrayList()
>>> if userRnd1.Text.Trim() != ""
>>> there are text fields for the random numbers
>>> end if
>>> if userRnd2.Text.Trim() != ""
>>> end if
>>> ...
>>>
>>> ' if the generate would return an arraylist of x random numbers:
>>> int x = 6 - userRandomNumbers.Count
>>> userRandomNumbers.Sort()
>>>
>>> 'if you want to display the resulting numbers on your webform:
>>> userRnd1.Text.= userRandomNumbers[0]
>>> userRnd2.Text.= userRandomNumbers[1]
>>> ...
>>>
>>> ' code that post data to database goes here...
>>>
>>> "Leon" <(E-Mail Removed)> wrote in message
>>> news:O%(E-Mail Removed)...
>>>> Thanks for your reply, but what I want to do is pass the randomly
>>>> generated numbers from the Generate function which is in the business
>>>> tier to my webform.
>>>> Do I need to declare the Generate function as a ArrayList or build a
>>>> separate ArrayList function or sub and pass the values from there to my
>>>> page?
>>>> OR....
>>>> How do I get the five generated number from this class which is in the
>>>> business tier to my webform?
>>>
>>>

>>
>>

>
>

Leon
Guest
Posts: n/a

 11-26-2004
Thanks for all the help I got it. LOOK! in the code I posted all the
textboxes was the same name so all the values went to that textbox.

Me.TextBox1.Text = test.Item(0)
Me.TextBox1.Text = test.Item(1)
Me.TextBox1.Text = test.Item(2)
Me.TextBox1.Text = test.Item(3)
Me.TextBox1.Text = test.Item(4)
Me.TextBox1.Text = test.Item(5)

"Leon" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>I use the stack just to make sure I get 5 unique random number back.
>however, what I sent was all the code and what I meant by say "the number
>are there when I step into my project is the numbers are in the stack, but
>it only sends one value back to the calling function ArrayList. maybe I can
>change the stack to ArrayList but my biggest problem is getting from the
>Generate Function ArrayList to my textboxes in my webform on button click.
>
> "mortb" <mortb1<noospam<@hotmail.com> wrote in message
> news:(E-Mail Removed)...
>> If the numbers are there when you step into the code then the problem has
>> to be somwhere else -- somewhere in the code that you haven't posted.
>>
>> By the way, why do you create a stack? and an array? It seems you only
>> need the array list which you return...
>>
>> cheers,
>> mortb
>>
>> Private Function Generate(ByVal Value As Integer) As ArrayList
>> Dim arrl As ArrayList(Value)
>> For j = 0 To Value
>> Dim rnd as integer = GetRandomNumber()
>> While arrl.Contains(rnd)
>> rnd = GetRandomNumber()
>> End While
>> Next
>> Generate = arrl
>> End Function
>>
>>
>> "Leon" <(E-Mail Removed)> wrote in message
>> news:(E-Mail Removed)...
>>> Thanks For all the help, but this is my code and it runs but it only
>>> return one value to the textbox and I know the other values exist
>>> because I step inside of my code. what do you see that I'm doing wrong.
>>> thanks again!!!
>>>
>>> Private Function Generate(ByVal Value As Integer) As ArrayList
>>> 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
>>> Dim I As Integer
>>> Dim UserNum As ArrayList = New ArrayList
>>> For I = 0 To Value
>>> Next
>>> Generate= New ArrayList(UserNum)
>>> End Function
>>>
>>> And then this code is in my code behind class...............
>>>
>>> Dim test As ArrayList
>>> test = newPick.GeneratePick(5)
>>>
>>> Me.TextBox1.Text = test.Item(0)
>>> Me.TextBox1.Text = test.Item(1)
>>> Me.TextBox1.Text = test.Item(2)
>>> Me.TextBox1.Text = test.Item(3)
>>> Me.TextBox1.Text = test.Item(4)
>>> Me.TextBox1.Text = test.Item(5)
>>>
>>> "mortb" <mortb1<noospam<@hotmail.com> wrote in message
>>> news:(E-Mail Removed)...
>>>> Like this (pseudo code not compiled)?
>>>> Page code behind:
>>>>
>>>> submit onclick:
>>>>
>>>> Dim userRandomNumbers as ArrayList = new ArrayList()
>>>> if userRnd1.Text.Trim() != ""
>>>> there are text fields for the random numbers
>>>> end if
>>>> if userRnd2.Text.Trim() != ""
>>>> end if
>>>> ...
>>>>
>>>> ' if the generate would return an arraylist of x random numbers:
>>>> int x = 6 - userRandomNumbers.Count
>>>> userRandomNumbers.Sort()
>>>>
>>>> 'if you want to display the resulting numbers on your webform:
>>>> userRnd1.Text.= userRandomNumbers[0]
>>>> userRnd2.Text.= userRandomNumbers[1]
>>>> ...
>>>>
>>>> ' code that post data to database goes here...
>>>>
>>>> "Leon" <(E-Mail Removed)> wrote in message
>>>> news:O%(E-Mail Removed)...
>>>>> Thanks for your reply, but what I want to do is pass the randomly
>>>>> generated numbers from the Generate function which is in the business
>>>>> tier to my webform.
>>>>> Do I need to declare the Generate function as a ArrayList or build a
>>>>> separate ArrayList function or sub and pass the values from there to
>>>>> my page?
>>>>> OR....
>>>>> How do I get the five generated number from this class which is in the
>>>>> business tier to my webform?
>>>>
>>>>
>>>
>>>

>>
>>

>
>

mortb
Guest
Posts: n/a

 11-30-2004
Most small errors...so easy to miss and yet so obvious...we've all been
there

"Leon" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Thanks for all the help I got it. LOOK! in the code I posted all the
> textboxes was the same name so all the values went to that textbox.
>
> Me.TextBox1.Text = test.Item(0)
> Me.TextBox1.Text = test.Item(1)
> Me.TextBox1.Text = test.Item(2)
> Me.TextBox1.Text = test.Item(3)
> Me.TextBox1.Text = test.Item(4)
> Me.TextBox1.Text = test.Item(5)
>