- Mar 8, 2003
- 38,416
- 4
- 0
Writing a graphical interface for a console application on sourceforge in VB.NET 2005 for personal use, I am more of a c++ kind of guy and I have not messed with VB since VB 6 (with a little VBA thrown around for access's sake). I even caught myself priming a certain VB loop the other day
Anyway, I am trying to create an array of processes.
in the main form's declarations I have the global variable:
Dim prcRipper(99) as process
I then try to assign it to an executable when the form loads by doing this, so that I might call for its execution later:
Dim i As Integer = 0
For i = 0 To 99
prcRipper(i).StartInfo.FileName = "theexecutable.exe"
Next i
error says that "NullReferenceException was unhandled"
Object reference not set to an instance of an object
Normally I would use the "new" command to handle this, but I cant seem to figure out the syntax in regard to an array of this unique nature.
Everything works fine when I use the tool at form view to create the process object and map it using the properties window, but I do not want to do that 100 times when I could use an array.
Update: I figured it out, see my reply later in the thread
Anyway, I am trying to create an array of processes.
in the main form's declarations I have the global variable:
Dim prcRipper(99) as process
I then try to assign it to an executable when the form loads by doing this, so that I might call for its execution later:
Dim i As Integer = 0
For i = 0 To 99
prcRipper(i).StartInfo.FileName = "theexecutable.exe"
Next i
error says that "NullReferenceException was unhandled"
Object reference not set to an instance of an object
Normally I would use the "new" command to handle this, but I cant seem to figure out the syntax in regard to an array of this unique nature.
Everything works fine when I use the tool at form view to create the process object and map it using the properties window, but I do not want to do that 100 times when I could use an array.
Update: I figured it out, see my reply later in the thread