INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Object reference not set to an instance of an object. Error

Object reference not set to an instance of an object. Error

(OP)
I have created a structure in a Module:

CODE --> VB.Net

Structure CTPParm
        Dim Color As Long
        Dim LineWeight As Integer
        Dim Title As String
        Dim Position As Long
        Dim AxisIndex As Integer
End Structure

Structure Graph
        Public Shared AxisConfiguration As AxisConfig
        Public Shared LegendConfiguration As LegendConfig
        <VBFixedArray(48)> Shared TraceConfiguration() As CTPParm
        Public Sub Initialize()
            ReDim TraceConfiguration(48)
        End Sub
    End Structure 

The AxisConfiguration & LegendConfiguration work properly.
The TraceConfiguration(48) when used causes the error

My intention is such that usage is as follows:
Graph.TraceConfiguration(bb).AxisIndex = 1

The error generated is "Object reference not set to an instance of an object.", and refers to a line similar to the previous line of text.

I'm pretty sure it has to do with the <VBFixedArray(48)> Shared TraceConfiguration() As CTPParm line of code.

Incidentally, the CTPParm structure is used by other structures and works fine.

I can't figure out how to fix this.
Any assistance and/or insight would be greatly appreciated!

Thanks!

RE: Object reference not set to an instance of an object. Error

(OP)
Turns out this is the fix:

CODE --> VB.Net

Structure Graph
        Dim Axis As Integer
        Public Shared AxisConfiguration As AxisConfig
        Public Shared LegendConfiguration As LegendConfig
        <VBFixedArray(48)> Shared TraceConfiguration() As CTPParm
        Shared Sub New()
            ReDim TraceConfiguration(48)
        End Sub
End Structure 

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close