473,545 Members | 2,639 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ArrayList Function In Business Tier?

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(a rrl(I))

'Next

'GeneratePick = SortPick(pickNu ms)
End Function

'Just Tried something did not work

'Public Function SortPick(ByVal UserPick As ArrayList)

'UserPick.Sort( )

'End Function

Nov 18 '05 #1
9 1402
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(numbe rOfNumbers)
Dim rand as random = new Random()
for i as integer = 0 to numberOfNumbers
Dim rnd as integer = rand.Next()
while(al.Contai ns(rnd))
rnd = rand.Next()
end while
al.Add(rnd)
next
al.Sort()
Generate = new Stack(al)
End Function

pseudo code:
page_onload

stack = generate
textbox1 = (stack.pop)ToSt ring()
textbox2 = (stack.pop)ToSt ring()
..

end function

"Leon" <vn*****@msn.co m> wrote in message
news:eU******** ******@TK2MSFTN GP15.phx.gbl...
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(a rrl(I))

'Next

'GeneratePick = SortPick(pickNu ms)
End Function

'Just Tried something did not work

'Public Function SortPick(ByVal UserPick As ArrayList)

'UserPick.Sort( )

'End Function

Nov 18 '05 #2
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:uI******** ******@TK2MSFTN GP09.phx.gbl...
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(numbe rOfNumbers)
Dim rand as random = new Random()
for i as integer = 0 to numberOfNumbers
Dim rnd as integer = rand.Next()
while(al.Contai ns(rnd))
rnd = rand.Next()
end while
al.Add(rnd)
next
al.Sort()
Generate = new Stack(al)
End Function

pseudo code:
page_onload

stack = generate
textbox1 = (stack.pop)ToSt ring()
textbox2 = (stack.pop)ToSt ring()
..

end function

"Leon" <vn*****@msn.co m> wrote in message
news:eU******** ******@TK2MSFTN GP15.phx.gbl...
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(a rrl(I))

'Next

'GeneratePick = SortPick(pickNu ms)
End Function

'Just Tried something did not work

'Public Function SortPick(ByVal UserPick As ArrayList)

'UserPick.Sort( )

'End Function


Nov 18 '05 #3
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?
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:Oy******** ******@tk2msftn gp13.phx.gbl...
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:uI******** ******@TK2MSFTN GP09.phx.gbl...
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(numbe rOfNumbers)
Dim rand as random = new Random()
for i as integer = 0 to numberOfNumbers
Dim rnd as integer = rand.Next()
while(al.Contai ns(rnd))
rnd = rand.Next()
end while
al.Add(rnd)
next
al.Sort()
Generate = new Stack(al)
End Function

pseudo code:
page_onload

stack = generate
textbox1 = (stack.pop)ToSt ring()
textbox2 = (stack.pop)ToSt ring()
..

end function

"Leon" <vn*****@msn.co m> wrote in message
news:eU******** ******@TK2MSFTN GP15.phx.gbl...
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(a rrl(I))

'Next

'GeneratePick = SortPick(pickNu ms)
End Function

'Just Tried something did not work

'Public Function SortPick(ByVal UserPick As ArrayList)

'UserPick.Sort( )

'End Function



Nov 18 '05 #4
Like this (pseudo code not compiled)?
Page code behind:

submit onclick:

Dim userRandomNumbe rs as ArrayList = new ArrayList()
if userRnd1.Text.T rim() != ""
userRandomNumbe rs.Add(int.Pars e(userRnd1.Text .Trim())) ' Assuming there
are text fields for the random numbers
end if
if userRnd2.Text.T rim() != ""
userRandomNumbe rs.Add(int.Pars e(userRnd2.Text .Trim()))
end if
....

' if the generate would return an arraylist of x random numbers:
int x = 6 - userRandomNumbe rs.Count
userRandomNumbe rs.AddRange(Bus inessObject.Gen erate(x))
userRandomNumbe rs.Sort()

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

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

"Leon" <vn*****@msn.co m> wrote in message
news:O%******** *******@TK2MSFT NGP12.phx.gbl.. .
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?

Nov 18 '05 #5
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
UserNum.Add(arr 1(I))
Next
Generate= New ArrayList(UserN um)
End Function

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

Dim test As ArrayList
test = newPick.Generat ePick(5)

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

"mortb" <mortb1<noospam <@hotmail.com > wrote in message
news:OM******** ******@TK2MSFTN GP10.phx.gbl...
Like this (pseudo code not compiled)?
Page code behind:

submit onclick:

Dim userRandomNumbe rs as ArrayList = new ArrayList()
if userRnd1.Text.T rim() != ""
userRandomNumbe rs.Add(int.Pars e(userRnd1.Text .Trim())) ' Assuming there
are text fields for the random numbers
end if
if userRnd2.Text.T rim() != ""
userRandomNumbe rs.Add(int.Pars e(userRnd2.Text .Trim()))
end if
...

' if the generate would return an arraylist of x random numbers:
int x = 6 - userRandomNumbe rs.Count
userRandomNumbe rs.AddRange(Bus inessObject.Gen erate(x))
userRandomNumbe rs.Sort()

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

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

"Leon" <vn*****@msn.co m> wrote in message
news:O%******** *******@TK2MSFT NGP12.phx.gbl.. .
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?


Nov 18 '05 #6
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(r nd)
rnd = GetRandomNumber ()
End While
arrl .Add(rnd)
Next
Generate = arrl
End Function
"Leon" <vn*****@msn.co m> wrote in message
news:uo******** ******@TK2MSFTN GP09.phx.gbl...
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
UserNum.Add(arr 1(I))
Next
Generate= New ArrayList(UserN um)
End Function

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

Dim test As ArrayList
test = newPick.Generat ePick(5)

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

"mortb" <mortb1<noospam <@hotmail.com > wrote in message
news:OM******** ******@TK2MSFTN GP10.phx.gbl...
Like this (pseudo code not compiled)?
Page code behind:

submit onclick:

Dim userRandomNumbe rs as ArrayList = new ArrayList()
if userRnd1.Text.T rim() != ""
userRandomNumbe rs.Add(int.Pars e(userRnd1.Text .Trim())) ' Assuming
there are text fields for the random numbers
end if
if userRnd2.Text.T rim() != ""
userRandomNumbe rs.Add(int.Pars e(userRnd2.Text .Trim()))
end if
...

' if the generate would return an arraylist of x random numbers:
int x = 6 - userRandomNumbe rs.Count
userRandomNumbe rs.AddRange(Bus inessObject.Gen erate(x))
userRandomNumbe rs.Sort()

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

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

"Leon" <vn*****@msn.co m> wrote in message
news:O%******** *******@TK2MSFT NGP12.phx.gbl.. .
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?



Nov 18 '05 #7
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:u1******** ******@TK2MSFTN GP12.phx.gbl...
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(r nd)
rnd = GetRandomNumber ()
End While
arrl .Add(rnd)
Next
Generate = arrl
End Function
"Leon" <vn*****@msn.co m> wrote in message
news:uo******** ******@TK2MSFTN GP09.phx.gbl...
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
UserNum.Add(arr 1(I))
Next
Generate= New ArrayList(UserN um)
End Function

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

Dim test As ArrayList
test = newPick.Generat ePick(5)

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

"mortb" <mortb1<noospam <@hotmail.com > wrote in message
news:OM******** ******@TK2MSFTN GP10.phx.gbl...
Like this (pseudo code not compiled)?
Page code behind:

submit onclick:

Dim userRandomNumbe rs as ArrayList = new ArrayList()
if userRnd1.Text.T rim() != ""
userRandomNumbe rs.Add(int.Pars e(userRnd1.Text .Trim())) ' Assuming
there are text fields for the random numbers
end if
if userRnd2.Text.T rim() != ""
userRandomNumbe rs.Add(int.Pars e(userRnd2.Text .Trim()))
end if
...

' if the generate would return an arraylist of x random numbers:
int x = 6 - userRandomNumbe rs.Count
userRandomNumbe rs.AddRange(Bus inessObject.Gen erate(x))
userRandomNumbe rs.Sort()

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

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

"Leon" <vn*****@msn.co m> wrote in message
news:O%******** *******@TK2MSFT NGP12.phx.gbl.. .
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?



Nov 18 '05 #8
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.Tex t = test.Item(0)
Me.TextBox1.Tex t = test.Item(1)
Me.TextBox1.Tex t = test.Item(2)
Me.TextBox1.Tex t = test.Item(3)
Me.TextBox1.Tex t = test.Item(4)
Me.TextBox1.Tex t = test.Item(5)

"Leon" <vn*****@msn.co m> wrote in message
news:ui******** ******@TK2MSFTN GP10.phx.gbl...
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:u1******** ******@TK2MSFTN GP12.phx.gbl...
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(r nd)
rnd = GetRandomNumber ()
End While
arrl .Add(rnd)
Next
Generate = arrl
End Function
"Leon" <vn*****@msn.co m> wrote in message
news:uo******** ******@TK2MSFTN GP09.phx.gbl...
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
UserNum.Add(arr 1(I))
Next
Generate= New ArrayList(UserN um)
End Function

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

Dim test As ArrayList
test = newPick.Generat ePick(5)

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

"mortb" <mortb1<noospam <@hotmail.com > wrote in message
news:OM******** ******@TK2MSFTN GP10.phx.gbl...
Like this (pseudo code not compiled)?
Page code behind:

submit onclick:

Dim userRandomNumbe rs as ArrayList = new ArrayList()
if userRnd1.Text.T rim() != ""
userRandomNumbe rs.Add(int.Pars e(userRnd1.Text .Trim())) ' Assuming
there are text fields for the random numbers
end if
if userRnd2.Text.T rim() != ""
userRandomNumbe rs.Add(int.Pars e(userRnd2.Text .Trim()))
end if
...

' if the generate would return an arraylist of x random numbers:
int x = 6 - userRandomNumbe rs.Count
userRandomNumbe rs.AddRange(Bus inessObject.Gen erate(x))
userRandomNumbe rs.Sort()

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

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

"Leon" <vn*****@msn.co m> wrote in message
news:O%******** *******@TK2MSFT NGP12.phx.gbl.. .
> 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?



Nov 18 '05 #9
Most small errors...so easy to miss and yet so obvious...we've all been
there :)

"Leon" <vn*****@msn.co m> wrote in message
news:OB******** ******@TK2MSFTN GP10.phx.gbl...
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.Tex t = test.Item(0)
Me.TextBox1.Tex t = test.Item(1)
Me.TextBox1.Tex t = test.Item(2)
Me.TextBox1.Tex t = test.Item(3)
Me.TextBox1.Tex t = test.Item(4)
Me.TextBox1.Tex t = test.Item(5)

Nov 18 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1019
by: Leon | last post by:
**I don't care if the solution is in C#!!!!! 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...
5
2041
by: G. Stewart | last post by:
The word "Business" in the term implies some sort of commercial aspects or connotations. But from what I can see, that is not necesserially the case at all? So what is the reasoning behind the term? Stupid question, I know ... and quite irrelevant in many ways ... but I really would like to know!
8
1658
by: Keith-Earl | last post by:
Okay, looking for a Best Practice. We are building a classic three tier app in VB.NET. When we load up a WebForm we have access to very useful objects such as the Session object. We frequently store short lists in Session or even Application objects and retrieve them later without having to make a round trip to the db. We think the best...
1
2680
by: sd | last post by:
QUESTION: How can my ASP page - which uses language="VBScript" - pass a "System.Collections.ArrayList" object - as a parameter - to a C# method in the middle-tier ??? ----- Is it possible at all? - if not, what work-a-round is there? I have no issues passing "string" parameters successfully to other methods in the same "middle-tier" -...
0
903
by: Leon | last post by:
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...
18
2828
by: D Witherspoon | last post by:
I am developing a Windows Forms application in VB.NET that will use .NET remoting to access the data tier classes. A very simple way I have come up with is by creating typed (.xsd) datasets. For example dsParts.xsd and including that in the data tier. I then will create a class that looks like this Public Class CPart Inherits dsParts
1
1411
by: Nemisis | last post by:
Hi everyone, We are currently re-developing our software, to asp.net 2.0 and taking a 3 tier architecture. I have been thinking about it, and i think that it belongs in the business tier. Another thing is am thinking about is what sort of caching should be done, because i really dont want to tie the business layer to only web
4
3005
by: pratham | last post by:
Hi! I'm making a database application and i heard from a friend that it is more proffecional and easy to do this with bussines objects. Can anyone tell me where i can find more info on bussines objects and how to implement them with c#? I would appreciate any help. How can i decide that what things go into business layer and what
2
2624
by: grawsha2000 | last post by:
Greetings, I am developing this N-tier business app. The problem I'm facing is when I try to pass business objects (employees, dept..etc) from business tier to data tier,i.e., the add method in the data tier expects business object from the business tier, I get an error saying: Can not covert businesslayer.emp to businesslayer.emp
0
7935
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7449
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7780
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6009
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5069
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3479
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3465
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1911
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1037
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.