MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.
Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.
Public Class TestService Private _worker As New Worker() Protected Overrides Sub OnStart(ByVal args() As String) Dim wt As System.Threading.Thread Dim ts As System.Threading.ThreadStart ts = AddressOf _worker.DoWork wt = New System.Threading.Thread(ts) wt.Start() End Sub Protected Overrides Sub OnStop() _worker.StopWork() End Sub Public Class Worker Private m_thMain As System.Threading.Thread Private m_booMustStop As Boolean = False Private m_rndGen As New Random(Now.Millisecond) Public Sub StopWork() m_booMustStop = True If Not m_thMain Is Nothing Then If Not m_thMain.Join(100) Then m_thMain.Abort() End If End If End Sub Public Sub DoWork() Dim TestCounter As Integer = 0 'we'll stop the the service after we loop through twice m_thMain = System.Threading.Thread.CurrentThread Dim i As Integer = m_rndGen.Next m_thMain.Name = "Thread" & i.ToString While Not m_booMustStop TestCounter += 1 System.Diagnostics.EventLog.WriteEntry("EmptyService", "Start work: " & m_thMain.Name) System.Threading.Thread.Sleep(10000) System.Diagnostics.EventLog.WriteEntry("EmptyService", "Finish work: " & m_thMain.Name) If TestCounter > 1 Then StopWork() End While End Sub End Class End Class
|vb.net winforms sizing/resolution?||4||42|
|Create a datatable in vb.net dynamically||1||22|
|SQL Server Connection String through a VPN||8||55|
|how to check group permission on a file located on a remote server ?||3||24|