Vb.net 将进度条值打印到文本框

Vb.net 将进度条值打印到文本框,vb.net,Vb.net,我正在尝试将progressbar的百分比打印到文本框中。当我运行程序时,文本框中不会显示任何内容。这是我的代码: Private Sub Button11_Click(sender As Object, e As EventArgs) Handles Button11.Click ProgressBar1.Maximum = TextBox1.Text End Sub 非常感谢您的帮助!谢谢。以下是我为您编写的一些代码供您查看,它将引导您朝着正确的方向前进,并

我正在尝试将progressbar的百分比打印到文本框中。当我运行程序时,文本框中不会显示任何内容。这是我的代码:

    Private Sub Button11_Click(sender As Object, e As EventArgs) Handles Button11.Click
        ProgressBar1.Maximum = TextBox1.Text
    End Sub

非常感谢您的帮助!谢谢。

以下是我为您编写的一些代码供您查看,它将引导您朝着正确的方向前进,并帮助您前进:)

末级

让我知道你的情况,我生活在一个无法访问你发布的网站链接的国家。
快乐编码


更新:请查看google上的backgroundworkers,这里有很多教程可以帮助您:)

您的代码的相关部分应始终根据直接发布在您的问题中。除此之外,您是否想过使用a不断更新您的文本框?
Imports System.ComponentModel

Public Class Form1
''This will display the information to the textbox and will also load a progressbar(you can change it to something else beside a textbox too eg label, windows form title and so on).
Private Sub BackgroundWorker1_ProgressChanged(sender As Object, e As ProgressChangedEventArgs) Handles BackgroundWorker1.ProgressChanged
    TextBox1.Text = e.ProgressPercentage & "%"
    ProgressBar1.Value = e.ProgressPercentage
End Sub

Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
    ''This is make the backgroundworker start at load up(change it to a button if need be
    CheckForIllegalCrossThreadCalls = False
    BackgroundWorker1.RunWorkerAsync()
End Sub

Private Sub BackgroundWorker1_DoWork(sender As Object, e As DoWorkEventArgs) Handles BackgroundWorker1.DoWork
    ''This is the example that i created to show you how to set a task.
    For i = 0 To 10000
        TextBox1.Text = i
        BackgroundWorker1.ReportProgress(i)
        System.Threading.Thread.Sleep(500)
    Next
    End Sub

Private Sub BackgroundWorker1_RunWorkerCompleted(sender As Object, e As RunWorkerCompletedEventArgs) Handles BackgroundWorker1.RunWorkerCompleted
    ''once the task is complete it will show a messagebox and reset the progressbars value to 0 so its not full when the task is compelete.
    MessageBox.Show("Completed")
    ProgressBar1.Value = 0
End Sub