hanonymouss
Gebruiker
- Lid geworden
- 7 sep 2011
- Berichten
- 283
Hallo allemaal ik gebruik in mijn programma multi threading zodat het programma niet crasht.
De code werkt goed maar ik krijg een waarschuwing:
Hoe kan ik ervoor zorgen dat ik die waarschuwing niet meer krijg
code:
[CPP]Imports System.Threading
Public Class Form1
Public m_Thread As Thread
Private Sub Button4_Click_1(sender As System.Object, e As System.EventArgs) Handles Button4.Click
If Button4.Text = "start" Then
m_Thread = New Thread(AddressOf test)
m_Thread.IsBackground = True
m_Thread.Start()
Button5.Enabled = True
Button4.Text = "stop"
ElseIf Button4.Text = "stop" Then
Button4.Text = "start"
Button5.Enabled = False
m_Thread.Abort()
End If
End Sub
Private Sub Button5_Click(sender As System.Object, e As System.EventArgs) Handles Button5.Click
If Button5.Text = "Pauze" Then
m_Thread.Suspend()
Button4.Enabled = False
Button5.Text = "Hervatten"
ElseIf Button5.Text = "Hervatten" Then
Button4.Enabled = True
m_Thread.Resume()
Button5.Text = "Pauze"
End If
End Sub[/CPP]
graag julliue hulp
De code werkt goed maar ik krijg een waarschuwing:
Code:
Public Sub Resume()' is obsolete: 'Thread.Resume has been deprecated. Please use other classes in System.Threading, such as Monitor, Mutex, Event, and Semaphore, to synchronize Threads or protect resources. http://go.microsoft.com/fwlink/?linkid=14202'.
Hoe kan ik ervoor zorgen dat ik die waarschuwing niet meer krijg
code:
[CPP]Imports System.Threading
Public Class Form1
Public m_Thread As Thread
Private Sub Button4_Click_1(sender As System.Object, e As System.EventArgs) Handles Button4.Click
If Button4.Text = "start" Then
m_Thread = New Thread(AddressOf test)
m_Thread.IsBackground = True
m_Thread.Start()
Button5.Enabled = True
Button4.Text = "stop"
ElseIf Button4.Text = "stop" Then
Button4.Text = "start"
Button5.Enabled = False
m_Thread.Abort()
End If
End Sub
Private Sub Button5_Click(sender As System.Object, e As System.EventArgs) Handles Button5.Click
If Button5.Text = "Pauze" Then
m_Thread.Suspend()
Button4.Enabled = False
Button5.Text = "Hervatten"
ElseIf Button5.Text = "Hervatten" Then
Button4.Enabled = True
m_Thread.Resume()
Button5.Text = "Pauze"
End If
End Sub[/CPP]
graag julliue hulp