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!