The issue is that an exception is being thrown because alerts
is Nothing
.
The easy way around this is to initialize the string with a -1 size so that it is an empty array.
Public Shared alerts As String(-1)
The correct way is to test for Nothing before attempting to use it.
If alerts IsNot Nothing Then
' Do something with it
The other thing that you must do is add exception handling to the load event or add a AppDomain unhandled exception handler or handle the WinforsFormsApplicaBase UnhandledException event.
Load event:
Try
Catch theException As Exception
Call MsgBox(theException.Message)
End Try