Quantcast
Channel: VBForums
Viewing all articles
Browse latest Browse all 42220

VS 2010 Object Reference not set to an instance of an object

$
0
0
Im sure this is an easy issue but i have been banging my head on the desk about it.

I have class A which imports class B which imports class C. In class C i have a function that when run produces the following error "Object reference not set to an instance of an object" and the program fails miraculously.

Below is a sample of how im trying to accomplish my goal
Class A
Code:

Imports ClassB
public class ClassA
 Private var As ClassB = new ClassB("view")

End Class

Class B
Code:

Imports ClassC
public class ClassB
Private var2 as ClassC
private var3 as List(Of Image)

Public Sub New(ByVal view as String")
  var2 = new ClassC
  var3 = Me.var2.getGuide(view)
End Sub 
End Class

Class C
Code:

Public Class ClassC
    private var4 as List(of Image)

    Public Function getGuide(ByVal view as String)
        var4.clear()
        Select Case view
            case "view"
                var4.add(My.Resources.Logo)
            End Select
            return var4
      End Select
End Function

Hopefully the simple code example is helpful. The error always pops in class C as i enter into the select statement. Any guidance would be appreciated.

Viewing all articles
Browse latest Browse all 42220

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>