The error is here:
Dim textz As String = TextBox1.Text
and here:
Dim NewArray() As String = TextBox1.Text.Split(vbNewLine)
and maybe here:
Dim sections() As String = Text.Split(sep, StringSplitOptions.None)
You cannot initialize such an element, because this code is mainly executed in the constructor, until TextBox1 (or any other control / property) is initialized, therefore, it is Nothing .
Put all the initializations related to the controls inside the Form_Load event - thatβs what it is for him.
source share