I've read this post: http://www.xtremedotnettalk.com/showthread.php?t=76924
and have successfully created a thread without using the backgroudnworkerprocess doing this
the functions.logerror call is a class that takes the passed string and sticks it into a listview on my form then writes that string to a logfile as well.
in the above code the messagebox pops up but the string 'boogieman' never makes it to the list. other areas of my project that arn't threaded use that logerror function very heavily (verbose). i just need to get this thread to be able to write to it too.
I saw on the above url that I needed to use
Dim threadfunction As New MethodInvoker(AddressOf nonthreadfunction)
and in the thread i use Me.BeginInvoke(threadfunction)
but those are sub routines and trying to tie in my function that passes the string just confuses the hell out of me.
please advise.
and have successfully created a thread without using the backgroudnworkerprocess doing this
Code:
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
Dim DBSyncThread As Threading.Thread
Dim DBSyncThreadStart As New Threading.ThreadStart(AddressOf DBSync)
DBSyncThread = New Threading.Thread(DBSyncThreadStart)
DBSyncThread.IsBackground = True
DBSyncThread.Name = "DBSync"
DBSyncThread.Start()
End Sub
Private Sub DBSync()
MsgBox("ehasdf boogieman")
Functions.LogError("boogieman")
End Sub
the functions.logerror call is a class that takes the passed string and sticks it into a listview on my form then writes that string to a logfile as well.
in the above code the messagebox pops up but the string 'boogieman' never makes it to the list. other areas of my project that arn't threaded use that logerror function very heavily (verbose). i just need to get this thread to be able to write to it too.
I saw on the above url that I needed to use
Dim threadfunction As New MethodInvoker(AddressOf nonthreadfunction)
and in the thread i use Me.BeginInvoke(threadfunction)
but those are sub routines and trying to tie in my function that passes the string just confuses the hell out of me.
please advise.