Public Class ResultCollection
Inherits CollectionBase
Public Event ResultLoaded(ByVal CurrentRecord As Integer, ByVal TotalRecords As Integer)
Default Public Overridable ReadOnly Property Item(ByVal index As Integer) As Result
Get
Return CType(Me.List(index), Result)
End Get
End Property
Public Sub Add(ByVal Result As Result)
List.Add(Result)
End Sub
Public Sub New()
End Sub
Public Sub New(ByVal CycleCountCompletionID As Integer)
Dim CurrCount As Integer = 0
Dim TotalRecords As Integer = 0
Dim SQL As String = [OMITTED]
Dim DS As DataSet = VSMS.GetDataSet(SQL, VSMS.TRIPConnStr)
TotalRecords = DS.Tables(0).Rows.Count
For Each DR As DataRow In DS.Tables(0).Rows
CurrCount += 1
Me.Add(New Result(Convert.ToInt32(DR.Item("CycleCountResultID"))))
RaiseEvent ResultLoaded(CurrCount, TotalRecords) '<-- EVENT FIRES HERE AND IS HANDLED PROPERLY IF I ADD AN EVENT HANDLER TO THE SAME CLASS
Next
End Sub
End Class
Public Class Completion
Private WithEvents _Results As New ResultCollection
Public Sub LoadResults()
_Results = New ResultCollection(CycleCountCompletionID) '<--This SHOULD get the event handler to start firing events.
End Sub
Public Sub _Results_ResultLoaded(ByVal CurrentRecord As Integer, ByVal TotalRecords As Integer) Handles _Results.ResultLoaded
'EVENT SHOULD BE RAISED HERE, BUT DEBUGGING SHOWS THAT IT IS NOT HITTING THIS SUB.
Dim X As String = ""
End Sub
End Class
Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.
When asked, what has been your best career decision?
Deciding to stick with EE.
Being involved with EE helped me to grow personally and professionally.
Connect with Certified Experts to gain insight and support on specific technology challenges including:
We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE