Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27569

How to start Timer from Backgroundworker?

$
0
0
PHP Code:

 Public Class Form1
    Dim number_of_ticks 
As Integer 0

    
Private Sub Button1_Click(sender As ObjectAs EventArgsHandles Button1.Click
        BackgroundWorker1
.RunWorkerAsync()
    
End Sub

    
Private Sub BackgroundWorker1_DoWork(sender As ObjectAs System.ComponentModel.DoWorkEventArgsHandles BackgroundWorker1.DoWork
        timer1
.Enabled True
        timer1
.Start()
    
End Sub


    
Private Sub timer1_Tick(sender As ObjectAs EventArgsHandles timer1.Tick
        
If Not number_of_ticks >= 50 Then
            number_of_ticks 
+= 1
        
Else
            
timer1.Stop()
            
number_of_ticks 0
        End 
If
    
End Sub

End 
Class 

I want start timer from backgroundworker but not start timer. How to start/stop timer from backgroundworker?
Thanks for help.

Viewing all articles
Browse latest Browse all 27569

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>