DotNetNewsgroup.com  
web access to complete list of Microsoft.NET newsgroups
   home   |   control panel login   |   archive  |  
 
  carried group
academic
adonet
aspnet
aspnet.announcements
aspnet.buildingcontrols
aspnet.caching
aspnet.datagridcontrol
aspnet.mobile
aspnet.security
aspnet.webcontrols
aspnet.webservices
assignment_manager
datatools
dotnet.distributed_apps
dotnet.general
dotnet.myservices
dotnet.nternationalization
dotnet.scripting
dotnet.security
dotnet.vjsharp
dotnet.vsa
dotnet.xml
dotnetfaqs
framework
framework.clr
framework.compactframework
framework.component_services
framework.controls
framework.databinding
framework.drawing
framework.enhancements
framework.interop
framework.odbcnet
framework.performance
framework.remoting
framework.sdk
framework.setup
framework.webservices
framework.windowsforms
framework.wmi
frwk.windowsforms.designtime
lang.csharp
lang.jscript
lang.vb
lang.vb.controls
lang.vb.data
lang.vb.upgrade
lang.vc
lang.vc.libraries
  
 
start date: Fri, 20 Jul 2007 11:24:53 -0700,    posted on: microsoft.public.dotnet.framework.aspnet.webcontrols        back       

Thread Index
  1    unknown
          2    Teemu Keiski


Outofmemoryexception   
I am using Arraylist to populate a drop down

I get outofmemoryexception at this line
for (iYear = 0; iYear <= oYearsList.Count - 1; iYear++)
            {
                sHtml.Append("<option value='" + oYearsList.Add(iYear)
+ "'>" + oYearsList.Add(iYear) + "</option>");
            }

When I use:
for (iYear = 0; iYear <= oYearsList.Count - 1; iYear++)
            {
                sHtml.Append("<option value=2007>2007</option>");
            }

I dont get this exception. Is there anything wrong the way I am using
the Add method of Arraylist.
Date:Fri, 20 Jul 2007 11:24:53 -0700   Author:  

Re: Outofmemoryexception   
You are adding items to the ArrayList while you loop through the same 
arraylist. Sounds like infinite loop to me, right?

-- 
Teemu Keiski
AspInsider, ASP.NET MVP
http://blogs.aspadvice.com/joteke
http://teemukeiski.net



 wrote in message 
news:1184955893.264471.47110@i38g2000prf.googlegroups.com...

>I am using Arraylist to populate a drop down
>
> I get outofmemoryexception at this line
> for (iYear = 0; iYear <= oYearsList.Count - 1; iYear++)
>            {
>                sHtml.Append("<option value='" + oYearsList.Add(iYear)
> + "'>" + oYearsList.Add(iYear) + "</option>");
>            }
>
> When I use:
> for (iYear = 0; iYear <= oYearsList.Count - 1; iYear++)
>            {
>                sHtml.Append("<option value=2007>2007</option>");
>            }
>
> I dont get this exception. Is there anything wrong the way I am using
> the Add method of Arraylist.
> 
Date:Sun, 22 Jul 2007 17:21:25 +0300   Author:  

Google
 
Web dotnetnewsgroup.com


COPYRIGHT ?2005, EUROFRONT WORLDWIDE LTD., ALL RIGHT RESERVE  |   Contact us