Well, I am pretty sure that the stateless nature of web forms is your
problem (not the actually collections).
Basically, each time you submit a page to the server, ASP.NET creates a new
instance of you page class to handle it. When is handled the request, the
class is, in effect, discarded. This means that next to you click Button1,
it's knows nothing of your original collection. This is by design.
If you did not know this, I suggest you go back to some introductory
material on ASP.NET, and get to grips with it. Understanding what is happen
(and *why* its like this) is key to a happy like for an asp.net programmer.
Nick Holmes.
"Hanaa" <an*******@discussions.microsoft.com> wrote in message
news:BC**********************************@microsof t.com...
I'm new to Asp.net Could you expalin to me what do you mean by web forms
are stateless? The Following Code is the part written fro the Add button it is the same
as the one in the previous menthioned URL.
Dim mywidgetCol As New widgetCollection
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click Dim awidg As New Widget
awidg.name = TextBox1.Text
mywidgetCol.Add(awidg)
awidg.name = TextBox4.Text
mywidgetCol.Add(awidg)
TextBox2.Text = (mywidgetCol.Count - 1).ToString
End Sub