Hi,
I create an application which create then execute a DTS package.
I want to fill a TreeView using the events generated by the DTS package
(onerror, onprogress....)
my code works fine except if I turn off the ExecuteInMainTh read property
(ExecuteInMainT hread = False)
In this case I can't fill my TreeView but I can send Console output texts.
I have try to use the delegation to invoke my functions which update the
treeview, but without success.
I'm using some code coming from this post:
and this one
I have 4 methods: SetValue, SetError, SetStart, SetFinish
each one add a new node in the treeview
For example:
Friend Sub SetStart(ByVal source As String)
Dim oNode As TreeNode
Dim oNode2 As TreeNode
oNode = FindNodeByName( source)
If oNode Is Nothing Then
oNode = New TreeNode(String .Format("{0}", source))
oNode.Tag = source
oRootNode.Nodes .Add(oNode)
If bFirstExpand Then
oRootNode.Expan d()
bFirstExpand = False
Application.DoE vents()
End If
End If
oNode2 = New TreeNode(String .Format("Start at: {0}", Now.ToString))
oNode.Nodes.Add (oNode2)
oNode.Expand()
End Sub
I have created a delegate object:
Public Delegate Sub SetStartDelegat e(ByVal source As String)
Friend SetStartDel As SetStartDelegat e = New SetStartDelegat e(AddressOf
Me.SetStart)
In my OnStart DTS event I call this:
Overridable Overloads Sub OnStart(ByVal EventSource As String) _
Implements DTS.PackageEven ts.OnStart
Console.WriteLi ne(" OnStart in {0}", EventSource)
Dim args() As Object = {EventSource}
frm.BeginInvoke (frm.SetStartDe l, args)
'frm.SetStart(E ventSource)
Application.DoE vents()
End Sub
but nothing appear. my SetStart method is called, but the code is locked at
this line:
oRootNode.Nodes .Add(oNode)
any guide?
thanks.
Jerome.
I create an application which create then execute a DTS package.
I want to fill a TreeView using the events generated by the DTS package
(onerror, onprogress....)
my code works fine except if I turn off the ExecuteInMainTh read property
(ExecuteInMainT hread = False)
In this case I can't fill my TreeView but I can send Console output texts.
I have try to use the delegation to invoke my functions which update the
treeview, but without success.
I'm using some code coming from this post:
and this one
I have 4 methods: SetValue, SetError, SetStart, SetFinish
each one add a new node in the treeview
For example:
Friend Sub SetStart(ByVal source As String)
Dim oNode As TreeNode
Dim oNode2 As TreeNode
oNode = FindNodeByName( source)
If oNode Is Nothing Then
oNode = New TreeNode(String .Format("{0}", source))
oNode.Tag = source
oRootNode.Nodes .Add(oNode)
If bFirstExpand Then
oRootNode.Expan d()
bFirstExpand = False
Application.DoE vents()
End If
End If
oNode2 = New TreeNode(String .Format("Start at: {0}", Now.ToString))
oNode.Nodes.Add (oNode2)
oNode.Expand()
End Sub
I have created a delegate object:
Public Delegate Sub SetStartDelegat e(ByVal source As String)
Friend SetStartDel As SetStartDelegat e = New SetStartDelegat e(AddressOf
Me.SetStart)
In my OnStart DTS event I call this:
Overridable Overloads Sub OnStart(ByVal EventSource As String) _
Implements DTS.PackageEven ts.OnStart
Console.WriteLi ne(" OnStart in {0}", EventSource)
Dim args() As Object = {EventSource}
frm.BeginInvoke (frm.SetStartDe l, args)
'frm.SetStart(E ventSource)
Application.DoE vents()
End Sub
but nothing appear. my SetStart method is called, but the code is locked at
this line:
oRootNode.Nodes .Add(oNode)
any guide?
thanks.
Jerome.
Comment