Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > General .NET
|
General .NET For general discussion of MICROSOFT .NET topics that don't fall within any of the other .NET forum subcategories or .NET language forums.  If your question is specific to a language (C# or Visual Basic) or type of application (Windows Forms or ASP.Net) try an applicable forum category. ** PLEASE BE SPECIFIC WITH YOUR QUESTION ** When posting here, provide details regarding the Microsoft .NET language you are using and/or what type of application (Windows/Web Forms, etc) you are working in, if applicable to the question. This will help others answer the question without having to ask.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the General .NET section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 4th, 2004, 12:27 AM
Authorized User
 
Join Date: Jun 2003
Posts: 61
Thanks: 0
Thanked 0 Times in 0 Posts
Default Problem Using ArrayList in VB.Net


  Hey guyz.. Am new to VB.Net en i was trying to have a user control object dynamically added to the form dependin on the amount of data received from a dataRow object. (Sample code below)

Private Function RoasterDataSource(ByVal row() As DataRow)
   Dim userCont As UserControl
   Dim ctlArray As New ArrayList()
   Dim I As Integer

           For I = 0 To row.GetLength(0)
            userCont = New ctlRoaster()
            If I < row.GetLength(0) Then
                With userCont
                    .StartDate = row(I)("fldStartTime")
                    .FinishDate = row(I)("fldEndTime")
                End With
            ElseIf I = row.GetLength(0) Then
                With userCont
                    .StartDate = Today()
                    .FinishDate = Today()
                End With
            End If
            y = y + Y2
            ctlArray.Add(userCont)
            Me.Controls.Add(userCont)
        Next I
End Function

The user control loads on the form fine and the data is reflected on the propertys correctly only on form load. The problem is if u call the function with a different row data (Assume 2 records be4 en 3 records after call) the array only updates the 3 record but keeps the original 2 recs. That is:: the ArrayList doesn't not begin from the first element in the ArrayList it reduces or Expands but still holds the original data values.

   I would like to have the ArrayList start from the first elemenet in the Array.
 If u can help please holla coz its startin to get in my skin.
Note:: The scope of the ArrayList is only in the function but that still happens HEEEEEEEEEEEELP!!!!



LION OF JUDDAH!
__________________
LION OF JUDDAH!





Similar Threads
Thread Thread Starter Forum Replies Last Post
ArrayList Problem erictamlam C# 2005 3 May 12th, 2007 10:04 AM
Problem Converting C# to VB.NET in ASP.NET kwilliams ASP.NET 2.0 Basics 0 February 9th, 2007 06:22 PM
problem in VB.NET? bhavna VS.NET 2002/2003 0 January 22nd, 2007 07:48 AM
Problem with Exercise in Beg. asp.net for VB.net! mrfella71 BOOK: Beginning ASP.NET 1.0 1 October 23rd, 2005 12:06 PM
problem in using this code in Vb.Net arctica82 VB.NET 2002/2003 Basics 1 April 15th, 2005 03:05 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.