I get this error when attempting to debug my form, I cannot see where at all the error could be (also does not highlight where), anyone have any suggestions?
An error occurred creating the form.
See Exception.InnerException for
details. The error is: Object
reference not set to an instance of an
object.
Dim dateCrap As String = "Date:"
Dim IPcrap As String = "Ip:"
Dim pcCrap As String = "Computer:"
Dim programCrap As String = "Program:"
Dim textz As String
Dim sep() As String = {vbNewLine & vbNewLine}
Dim sections() As String = Text.Split(sep, StringSplitOptions.None)
Dim NewArray() As String = TextBox1.Text.Split(vbNewLine)
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
textz = TextBox1.Text
End Sub
The error is here:
and here:
and possibly here:
You cannot initialize a member like this because this code is basically executed in the constructor, before
TextBox1(or any other control/property) is initialized, hence it isNothing.Put all initializations that refer to controls inside the
Form_Loadevent – that’s what it’s there for.