Forums
New posts
Search forums
What's new
New posts
New profile posts
Latest activity
Members
Current visitors
New profile posts
Search profile posts
C# Community
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
VB.NET
Windows Forms
updating form from backgroundworker
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="Ron Miel, post: 170767, member: 33608"] Okay, thanks guys. Following your advice I've got it to work. Realising that I didn't need to use a class made it a lot simpler. [code] Public Class Form1 Public Class Time_object Public Hours As Integer Public Minutes As Integer Public Seconds As Integer End Class Private Sub cmd_thread_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmd_thread.Click bgw_1.RunWorkerAsync() End Sub Private Sub bgw_1_DoWork(ByVal sender As System.Object, ByVal e As System.ComponentModel.DoWorkEventArgs) Handles bgw_1.DoWork Dim hours, minutes, seconds As Integer Dim the_time As String Dim time1 As New Time_object For hours = 0 To 24 time1.Hours = hours For minutes = 0 To 59 time1.Minutes = minutes For seconds = 0 To 59 time1.Seconds = seconds the_time = hours.ToString + ":" + minutes.ToString + ":" + seconds.ToString sender.ReportProgress(0, time1) Threading.Thread.Sleep(10) Next 'seconds Next 'minutes Next 'hours End Sub Private Sub bgw_1_ProgressChanged( ByVal sender As System.Object, ByVal e As System.ComponentModel.ProgressChangedEventArgs ) Handles bgw_1.ProgressChanged Dim Time1 As Time_object = CType(e.UserState, Time_object) Me.lbl_HH.Text = Time1.Hours Me.lbl_MM.Text = Time1.Minutes Me.lbl_SS.Text = Time1.Seconds End Sub End Class [/code] [/QUOTE]
Insert quotes…
Verification
Post reply
VB.NET
Windows Forms
updating form from backgroundworker
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.
Accept
Learn more…
Top
Bottom