定时提交数据,如何用线程实现
设置了定时器,60秒提交一次数据,因为提交数据量大,运行的时候,窗体会不动,但是还是在提交数据。
问如何如何用线程实现,60秒提交一次数据?
[解决办法]
- VB.NET code
imports System imports System.Threading public class AClass public sub Method1() Dim i as integer For i = 1 to 100 Console.Writeline("这是类AClass方法method1的内容",i) next end sub public sub Method2() Dim i as integer For i = 1 to 100 Console.Writeline("这是类AClass方法method2的内容",i) next end sub end class public class ThreadTest public shared sub Main() dim obj as new aclass dim th1,th2 as thread th1=new Thread(new ThreadStart(addressof obj.method1)) th1.start th2=new Thread(new ThreadStart(addressof obj.method2)) th2.start dim i as integer For i= 1 to 100 Console.WriteLine("Main方法里的内容",i) Next end sub end class