J
John-Arne Lillebø
Hi.
I run into this problem and i could need some help to solve it.
The project is an ASP.NET Web project.
Including code sample of the problem.
Any idea what is causing the error message ?
John-Arne Lillebø
The ASPX page:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'test is the project name.
Dim var_Companies As New test.clsCompanies
Dim var_Company As New test.clsCompany
Dim Index As Integer
var_Company.Name = "Test"
Index = var_Companies.Add(var_Company)
Index = var_Companies.Add(var_Company)
Index = var_Companies.Add(var_Company)
Index = var_Companies.Add(var_Company)
var_Company = Nothing
var_Companies = Nothing
End Sub
The Class1.vb file
Public Class clsCompanies
Private CompanyArray() As clsCompany
Public Sub New()
ReDim CompanyArray(0)
End Sub
Public Function Add(ByVal Obj As clsCompany) As Integer
Dim Index As Integer
Try
Index = clsArray.Add(CompanyArray, Obj)
Catch ex As Exception
System.Diagnostics.Debugger.Break()
Throw ex
Finally
Add = Index
End Try
End Function
End Class
Public Class clsCompany
Private var_Name As String
Public Property Name() As String
Get
Name = var_Name
End Get
Set(ByVal Value As String)
var_Name = Value
End Set
End Property
End Class
Public Class clsArray
Shared Function Add(ByRef objArray() As Object, ByVal Obj As Object) As
Integer
Dim Index As Integer
Index = -1
Try
If objArray.GetUpperBound(0) > 0 Or IsNothing(objArray(0)) =
False Then
ReDim Preserve objArray(objArray.GetUpperBound(0) + 1)
End If
objArray(objArray.GetUpperBound(0)) = Obj
Index = CInt(objArray.GetUpperBound(0))
Catch ex As Exception
System.Diagnostics.Debugger.Break()
Throw ex
Finally
End Try
Return Index
End Function
End Class
I run into this problem and i could need some help to solve it.
The project is an ASP.NET Web project.
Including code sample of the problem.
Any idea what is causing the error message ?
John-Arne Lillebø
The ASPX page:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'test is the project name.
Dim var_Companies As New test.clsCompanies
Dim var_Company As New test.clsCompany
Dim Index As Integer
var_Company.Name = "Test"
Index = var_Companies.Add(var_Company)
Index = var_Companies.Add(var_Company)
Index = var_Companies.Add(var_Company)
Index = var_Companies.Add(var_Company)
var_Company = Nothing
var_Companies = Nothing
End Sub
The Class1.vb file
Public Class clsCompanies
Private CompanyArray() As clsCompany
Public Sub New()
ReDim CompanyArray(0)
End Sub
Public Function Add(ByVal Obj As clsCompany) As Integer
Dim Index As Integer
Try
Index = clsArray.Add(CompanyArray, Obj)
Catch ex As Exception
System.Diagnostics.Debugger.Break()
Throw ex
Finally
Add = Index
End Try
End Function
End Class
Public Class clsCompany
Private var_Name As String
Public Property Name() As String
Get
Name = var_Name
End Get
Set(ByVal Value As String)
var_Name = Value
End Set
End Property
End Class
Public Class clsArray
Shared Function Add(ByRef objArray() As Object, ByVal Obj As Object) As
Integer
Dim Index As Integer
Index = -1
Try
If objArray.GetUpperBound(0) > 0 Or IsNothing(objArray(0)) =
False Then
ReDim Preserve objArray(objArray.GetUpperBound(0) + 1)
End If
objArray(objArray.GetUpperBound(0)) = Obj
Index = CInt(objArray.GetUpperBound(0))
Catch ex As Exception
System.Diagnostics.Debugger.Break()
Throw ex
Finally
End Try
Return Index
End Function
End Class