G
Guest
I am trying to create a queue of objects. I have a taskHolder object using a
Task class. I have an activeproject object of project class. Each project has
a queue called Tasks.
Everything looks good up to the point that i try to add the taskholder
object to the queue. I get an nullreferenceexception, indicating that
Me.taskholder is not defined. I even added a NULL test and I get a "wooo!"
every time. Even in the debugger I can see the values in taskholder while it
is saying it does not exist.
What am I doing wrong here?
Private Sub WereDone()
'we are done with this form and will now begin the output process
Dim row As Integer
taskHolder.Reset()
row = (Me.ActiveTask.Index - 2)
For count As Integer = 0 To row Step 1
taskHolder.Index = Me.TasksDataGridView1.Item(0, count).Value
taskHolder.Name = Me.TasksDataGridView1.Item(1, count).Value
taskHolder.TaskDuration = Me.TasksDataGridView1.Item(2,
count).Value
taskHolder.Pred.Add(1, (Me.TasksDataGridView1.Item(3,
count).Value))
taskHolder.BM = Me.TasksDataGridView1.Item(4, count).Value
taskHolder.TW = Me.TasksDataGridView1.Item(5, count).Value
If taskHolder Is Nothing Then
MsgBox("oh crap!")
Else
MsgBox("wooo!")
End If
StartForm.ActiveProject.Tasks.Enqueue(Me.taskHolder) <---- Here!
taskHolder.Reset()
Next
MsgBox(StartForm.ActiveProject.Tasks.Count)
End Sub
Thanks!
Task class. I have an activeproject object of project class. Each project has
a queue called Tasks.
Everything looks good up to the point that i try to add the taskholder
object to the queue. I get an nullreferenceexception, indicating that
Me.taskholder is not defined. I even added a NULL test and I get a "wooo!"
every time. Even in the debugger I can see the values in taskholder while it
is saying it does not exist.
What am I doing wrong here?
Private Sub WereDone()
'we are done with this form and will now begin the output process
Dim row As Integer
taskHolder.Reset()
row = (Me.ActiveTask.Index - 2)
For count As Integer = 0 To row Step 1
taskHolder.Index = Me.TasksDataGridView1.Item(0, count).Value
taskHolder.Name = Me.TasksDataGridView1.Item(1, count).Value
taskHolder.TaskDuration = Me.TasksDataGridView1.Item(2,
count).Value
taskHolder.Pred.Add(1, (Me.TasksDataGridView1.Item(3,
count).Value))
taskHolder.BM = Me.TasksDataGridView1.Item(4, count).Value
taskHolder.TW = Me.TasksDataGridView1.Item(5, count).Value
If taskHolder Is Nothing Then
MsgBox("oh crap!")
Else
MsgBox("wooo!")
End If
StartForm.ActiveProject.Tasks.Enqueue(Me.taskHolder) <---- Here!
taskHolder.Reset()
Next
MsgBox(StartForm.ActiveProject.Tasks.Count)
End Sub
Thanks!