|
 |
aspx thread: Structure Crashing
Message #1 by "J Donahue" <jdonahue@f...> on Wed, 11 Sep 2002 20:33:47
|
|
I have a class library that defines a structure along the following lines:
Public Const VAR1 = 0
Public Const VAR2 = 1
Public Const VAR3 = 2
Public Const ELEMENTS 3
Public Structure MyStructure
Public Data() As String
End Structure
Public InfoStruct As New MyStructure()
Public Sub InitializeStructures()
ReDim InfoStruct.Data(LOAN_ELEMENTS)
If Session("InfoSession")<> Nothing Then
InfoStruct = Session("InfoSession")
End Sub
End Sub
In my aspx page, I use the class library as follows:
Dim LoanRequest As New myClassLib()
Sub Page_Load(etc)
LoanRequest.InitalizeStructures()
LoanRequest.InfoStruct.Data(LoanRequest.VAR1) = "Something"
End Sub
The problem is that I keep getting an error that says the "object
reference is not set to an instance of the object".
I know I can use the structure if I get rid of the array and put in
individual strings to hold the data (I've done that already). It seems
to relate to the data() array. Do I have to somehow allocate for the
data array?? I though ReDim did the allocation for me??
Thanks all!!
Message #2 by "Armando G Zuniga" <a_zuniga@w...> on Wed, 11 Sep 2002 16:28:23 -0500
|
|
Misspelled LOAN_ELEMENTS?
-----Original Message-----
From: J Donahue [mailto:jdonahue@f...]
Sent: Wednesday, September 11, 2002 8:34 PM
To: ASP+
Subject: [aspx] Structure Crashing
I have a class library that defines a structure along the following lines:
Public Const VAR1 = 0
Public Const VAR2 = 1
Public Const VAR3 = 2
Public Const ELEMENTS 3
Public Structure MyStructure
Public Data() As String
End Structure
Public InfoStruct As New MyStructure()
Public Sub InitializeStructures()
ReDim InfoStruct.Data(LOAN_ELEMENTS)
If Session("InfoSession")<> Nothing Then
InfoStruct = Session("InfoSession")
End Sub
End Sub
In my aspx page, I use the class library as follows:
Dim LoanRequest As New myClassLib()
Sub Page_Load(etc)
LoanRequest.InitalizeStructures()
LoanRequest.InfoStruct.Data(LoanRequest.VAR1) = "Something"
End Sub
The problem is that I keep getting an error that says the "object
reference is not set to an instance of the object".
I know I can use the structure if I get rid of the array and put in
individual strings to hold the data (I've done that already). It seems
to relate to the data() array. Do I have to somehow allocate for the
data array?? I though ReDim did the allocation for me??
Thanks all!!
---
ASP.NET 1.0 Namespace Reference with C#
http://www.wrox.com/acon11.asp?ISBN=1861007442
ASP.NET 1.0 Namespace Reference with VB.NET
http://www.wrox.com/acon11.asp?ISBN=1861007450
These books are a complete reference to the ASP.NET namespaces
for developers who are already familiar with using ASP.NET.
There is no trivial introductory material or useless .NET
hype and the presentation of the namespaces, in an easy-to use
alphabetical order ensures a user-friendly reference format.
We provide in-depth coverage of all the major ASP.NET classes,
giving you those real-world tips that the documentation doesn't
offer, and demonstrating complex techniques with simple
examples.
---
Message #3 by "J Donahue" <jdonahue@f...> on Wed, 11 Sep 2002 23:32:18
|
|
I saw that I put LOAN_ELEMENTS in instead of ELEMENTS the instant I
submitted. But..no, that's not the problem.
Thanks!!!
> Misspelled LOAN_ELEMENTS?
-----Original Message-----
From: J Donahue [mailto:jdonahue@f...]
Sent: Wednesday, September 11, 2002 8:34 PM
To: ASP+
Subject: [aspx] Structure Crashing
I have a class library that defines a structure along the following lines:
Public Const VAR1 = 0
Public Const VAR2 = 1
Public Const VAR3 = 2
Public Const ELEMENTS 3
Public Structure MyStructure
Public Data() As String
End Structure
Public InfoStruct As New MyStructure()
Public Sub InitializeStructures()
ReDim InfoStruct.Data(ELEMENTS)
If Session("InfoSession")<> Nothing Then
InfoStruct = Session("InfoSession")
End Sub
End Sub
In my aspx page, I use the class library as follows:
Dim LoanRequest As New myClassLib()
Sub Page_Load(etc)
LoanRequest.InitalizeStructures()
LoanRequest.InfoStruct.Data(LoanRequest.VAR1) = "Something"
End Sub
The problem is that I keep getting an error that says the "object
reference is not set to an instance of the object".
I know I can use the structure if I get rid of the array and put in
individual strings to hold the data (I've done that already). It seems
to relate to the data() array. Do I have to somehow allocate for the
data array?? I though ReDim did the allocation for me??
Thanks all!!
---
ASP.NET 1.0 Namespace Reference with C#
http://www.wrox.com/acon11.asp?ISBN=1861007442
ASP.NET 1.0 Namespace Reference with VB.NET
http://www.wrox.com/acon11.asp?ISBN=1861007450
These books are a complete reference to the ASP.NET namespaces
for developers who are already familiar with using ASP.NET.
There is no trivial introductory material or useless .NET
hype and the presentation of the namespaces, in an easy-to use
alphabetical order ensures a user-friendly reference format.
We provide in-depth coverage of all the major ASP.NET classes,
giving you those real-world tips that the documentation doesn't
offer, and demonstrating complex techniques with simple
examples.
---
|
|
 |