Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/26.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Vb.net Visual Basic 2010 Live Logger_Vb.net_Logging - Fatal编程技术网

Vb.net Visual Basic 2010 Live Logger

Vb.net Visual Basic 2010 Live Logger,vb.net,logging,Vb.net,Logging,你好,我正在尝试在我的程序中制作一个实时记录器,以便跟踪进度。 像这样: 我如何制作这样的东西。 您可以使用带有列表框的后台工作程序来完成您的请求。在后台worker的reports progress方法中,您可以指定“userstate”对象来“记录”UI线程上的控件,只需确保将“worker reports progress”设置为true: Public Class Form1 Private Sub Form1_Load(ByVal sender As System.Object,

你好,我正在尝试在我的程序中制作一个实时记录器,以便跟踪进度。 像这样:

我如何制作这样的东西。

您可以使用带有列表框的后台工作程序来完成您的请求。在后台worker的reports progress方法中,您可以指定“userstate”对象来“记录”UI线程上的控件,只需确保将“worker reports progress”设置为true:

 Public Class Form1

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    'where you call your worker to do work
    BackgroundWorker1.RunWorkerAsync()


End Sub


Private Sub BackgroundWorker1_DoWork(ByVal sender As Object, ByVal e As System.ComponentModel.DoWorkEventArgs) Handles BackgroundWorker1.DoWork

    'make sure to set worker reports progress to true
    BackgroundWorker1.ReportProgress(0, "About to Messagebox") 'where 0 is a progress percent if you want it and the string is overloaded
    MsgBox("This is to show how to report before an event!")


End Sub

Private Sub BackgroundWorker1_ProgressChanged(ByVal sender As Object, ByVal e As System.ComponentModel.ProgressChangedEventArgs) Handles BackgroundWorker1.ProgressChanged

    '
    ListBox1.Items.Add(e.UserState)


End Sub
End Class

到目前为止,你尝试过什么样的工作?我要求制作一个实时日志,这样当我开始进度时,我可以看到这样的进度开始,工作,工作,过程结束。你有任何视频教程都无法理解YouTube是你的朋友:但是,你不必像视频中那个家伙说的那样使用代理,您可以使用reportsprogress传回所需的值。如何添加更多BackgroundWorker1。带有更多消息的ReportProgress(0,“即将发送消息框”)必须复制报告进度并更改字符串以匹配您需要它执行的操作?在某些时候,您需要定义所有可能出现或应该出现的字符串