2
My problem is this. I have this module that contains a variable of the integer type and this variable is accessed by a form that changes its value, as shown in the code below.
Module Module1
Public frm1 As New Form1
Public frm2 As New Form2
Public Uso As Integer
End Module
Public Class Form1
...
Private Sub MenuItem4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem4.Click
Uso = 1
frm2 = New Form2
frm2.MdiParent = Me
frm2.Text = "PROJETO DE TROCADOR DE CALOR"
frm2.Show()
End Sub
End Class
When compiling it normally opens Form1 (Mdicontainer). When I try to open a new file, MenuItem4_Click
, generates an exception. It says that the reference of an object has not been defined for an instance of this object.
This error happens with ALL variables of this Module1 that frm2 tries to access/modify.
I have done other programs using the same logic that never gave this bizarre error. I really need help!!!!
What happens is that when I need to assign a value to the Use variable it falls into an exception and says that the object reference was not set to an instance of this object. It has nothing to do with the frm2 that has already been declared!!!
– Gianpaolo Barci
Reference of an undefined object to an object instance is synonymous with null object, no value, look at its code, use variable
New
and note that there is no variable referenced.– CypherPotato
I did it, Cypher! It worked! I had a wrong reference in the frm2 code and I wouldn’t let it get started! As it is a program made in VB 2003 that was converted to 2013 appeared these bizarre errors of invalid references!
– Gianpaolo Barci