I created a do nothing solution to get rid of everything that doesn't
have to do with the problem I'm having.
'************************************************* **********************
*****
Public Class Form1
Inherits System.Windows.Forms.Form
Dim cls As Class1
Public Sub New()
MyBase.New()
InitializeComponent() 'this form contains only Button1 and
Lable1
cls = New Class1
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button1.Click
Dim frm As New Form2
frm.ShowDialog()
Label1.Text = cls.Test
End Sub
End Class
'************************************************* **********************
*****
Public Class Form2
Inherits System.Windows.Forms.Form
Friend cls As Class1
Public Sub New()
MyBase.New()
InitializeComponent() 'this form contains no controls
cls.Test = "string" 'ERROR OCCURS HERE
End Sub
End Class
'************************************************* **********************
*****
Public Class Class1
Private myTest As String
Public Sub New()
MyBase.new()
End Sub
Public Property Test() As String
Get
Return myTest
End Get
Set(ByVal Value As String)
myTest = Value
End Set
End Property
End Class
When I run this I get this error:
An unhandled exception of type 'System.NullReferenceException'
occurred in WindowsApplication1.exe
Additional information: Object reference not set to an instance of
an object.
In the assignment operation of Form2.New
*** Sent via Developersdex
http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!