问题描述
DataGridView1.DataSource=myDataview这个加载过程有点慢,我想加入一个进度条,请问该如何操作?
解决方案
解决方案二:
怎么没人回答呢?难道我的问题问得不好?
解决方案三:
DataGridView1.DataSource=myDataview加入一个进度条,可能需要记录总量,而且每获取一个记录需要刷新一次,不建议这样做;建议加入一个loadingGIF;具体多线程,MSDN里面好多。
解决方案四:
请问这个多线程该如何使用啊?
解决方案五:
OptionExplicitOnOptionStrictOnImportsSystem.Threading'Ourcustomdelegate.PublicDelegateFunctionBinaryOp(ByValxAsInteger,_ByValyAsInteger)AsIntegerModuleProgramSubMain()Console.WriteLine("*****AsyncDelegateInvocation*****")Console.WriteLine()'PrintouttheIDoftheexecutingthread.Console.WriteLine("Main()invokedonthread{0}.",_Thread.CurrentThread.ManagedThreadId)'InvokeAdd()onasecondarythread.DimbAsBinaryOp=NewBinaryOp(AddressOfAdd)DimitfARAsIAsyncResult=b.BeginInvoke(10,10,Nothing,Nothing)WhileNotitfAR.AsyncWaitHandle.WaitOne(2000,True)'Dootherworkonprimarythread...Console.WriteLine("DoingmoreworkinMain()!")Thread.Sleep(1000)EndWhile'ObtaintheresultoftheAdd()'methodwhenready.DimanswerAsInteger=b.EndInvoke(itfAR)Console.WriteLine("10+10is{0}.",answer)Console.ReadLine()EndSubFunctionAdd(ByValxAsInteger,ByValyAsInteger)AsInteger'PrintouttheIDoftheexecutingthread.Console.WriteLine("Add()invokedonthread{0}.",_Thread.CurrentThread.ManagedThreadId)'Pausetosimulatealengthyoperation.Thread.Sleep(5000)Returnx+yEndFunctionEndModule
解决方案六:
不太清楚拜帖學習一下
解决方案七:
请问wl58796351前辈,您写的程序应该新建什么项目实现,好像不是用windows窗体控件实现的?
解决方案八:
PrivateSubBackgroundWorker1_DoWork(ByValsenderAsSystem.Object,ByValeAsSystem.ComponentModel.DoWorkEventArgs)HandlesBackgroundWorker1.DoWorkDimaAsIntegerThread.Sleep(1000)BackgroundWorker1.ReportProgress(a)DataGridView1.DataSource=myDataviewEndSub用backgroundworker来解决,在dowork过程中仍然提示:Cross-threadoperationnotvalid:Control'DataGridView1'accessedfromathreadotherthanthethreaditwascreatedon.如果datagridview1被看成控件,对于dowork过程不能操作控件的要求,那岂不是用backgroundworker无法来解决些问题??????