473,406 Members | 2,371 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Trying to create a collectin of objects

Hi
I'm tyring to create a collection of an object inside an object I have tried to use the code written in the following URL
http://msdn.microsoft.com/library/de...ectionclass.as
its working fine when I test it from VB.net but my application is a web-application , I tried to use the same classes that I have created and tested in VB.Net the collection counter is always set to 1 even If I add 3 or 7 objects, I don't know why this is happing the same classes are working in VB Form, Any body know whats the problem ?
Jul 21 '05 #1
4 1373
Can you post some code from you web form? Have you remembered that web forms
are stateless?

Nick Holmes.

"hanaa" <an*******@discussions.microsoft.com> wrote in message
news:7B**********************************@microsof t.com...
Hi,
I'm tyring to create a collection of an object inside an object I have tried to use the code written in the following URL: http://msdn.microsoft.com/library/de...ctionclass.asp its working fine when I test it from VB.net but my application is a

web-application , I tried to use the same classes that I have created and
tested in VB.Net the collection counter is always set to 1 even If I add 3
or 7 objects, I don't know why this is happing the same classes are working
in VB Form, Any body know whats the problem ?
Jul 21 '05 #2
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.Clic
Dim awidg As New Widge
awidg.name = TextBox1.Tex
mywidgetCol.Add(awidg
awidg.name = TextBox4.Tex
mywidgetCol.Add(awidg
TextBox2.Text = (mywidgetCol.Count - 1).ToStrin
End Su

Jul 21 '05 #3
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

Jul 21 '05 #4
Thanks Alot, and I agree with you I think this was the problem.
Jul 21 '05 #5

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

Similar topics

8
by: Rich Grise | last post by:
I think I've finally found a tutorial that can get me started: http://www.zib.de/Visual/people/mueller/Course/Tutorial/tutorial.html and I've been lurking for awhile as well. What happened is,...
2
by: ianLOSEatTHEaltispartnersCAPS.com | last post by:
Hello, First and foremost appols for what must be the n-billionth "new programmer" post you've had but if someone could see their way clear to helping me, or just recomending some reading I...
4
by: hanaa | last post by:
Hi I'm tyring to create a collection of an object inside an object I have tried to use the code written in the following URL...
5
by: Simon Dean | last post by:
Hello, Im hoping you can help me. Im, probably not that advanced with PHP, well, I probably am, but with a memory like a sieve, I rarely take in information... But, Im just considering some...
2
by: Thirsty Traveler | last post by:
How would I dynamcially create an XML document of the following form: <ReceiveTSSCallBack xmlns="http://LandAm.EAI.Mainframe.TSR"> <TSSCallBack...
5
by: Learner | last post by:
Hello, Here is the code snippet I got strucked at. I am unable to convert the below line of code to its equavalent vb.net code. could some one please help me with this? static public...
27
by: jm | last post by:
I am having trouble understanding the purposes of an interface, even though the concept of interfaces is around me all the time (user interface, for example). I'm just not understanding software...
20
by: walterbyrd | last post by:
Reading "Think Like a Computer Scientist" I am not sure I understand the way it describes the way objects work with Python. 1) Can attributes can added just anywhere? I create an object called...
6
by: The Natural Philosopher | last post by:
I am trying to create what amounts to an array of 'structures'. I.e. I want to dynamically add to and access an object as myobject.anothernumber // actually represents a nesting level. and ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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...
0
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.