Welcome to Egypt Forums Mark forums read | Egypt Main Page
Egypt Forums
Arabic Movies



Programming Languages A Place for windows applications programs and programmers .

Programming Languages Thread, Using BackgroundWorker in VB.NET in Programming , WebDesign & Development; I was wondering if someone could give me an example of how to use the BackgroundWorker component in VB.NET/Visual Studio. ...

Short Link: http://forum.egypt.com/enforum/showthread.php?t=30317


Reply
LinkBack Thread Tools Display Modes
Using BackgroundWorker in VB.NET
 
 
Senior Member

Reply With Quote
 
Join Date: Dec 2008
Posts: 18,122
18-02-2009, 04:40 AM
 
I was wondering if someone could give me an example of how to use the BackgroundWorker component in VB.NET/Visual Studio. I am not sure how it works, but I want to make it when the user clicks a button and loads a list of values from a server, my...

I was wondering if someone could give me an example of how to use the BackgroundWorker component in VB.NET/Visual Studio. I am not sure how it works, but I want to make it when the user clicks a button and loads a list of values from a server, my program does not hang while it is loading.

I want to make the BackgroundWorker do this:
Code:
Public Function RefreshStatusList()
Dim users As LC.Users = Nothing
Dim user1 As New LC.LosingColor(My.Settings.Username.ToString, My.Settings.Password.ToString)
If My.Settings.TimeLine = 1 Then
users = user1.GetTimeline(LC.Timeline.Friends)
ElseIf My.Settings.TimeLine = 2 Then
users = user1.GetTimeline(LC.Timeline.Public)
ElseIf My.Settings.TimeLine = 3 Then
users = user1.GetTimeline(LC.Timeline.User)
ElseIf My.Settings.TimeLine = 4 Then
users = user1.GetTimeline(LC.Timeline.Replies)
End If
lstStatuses.Columns.Add("Username", 100, HorizontalAlignment.Left)
lstStatuses.Columns.Add("Status", 200, HorizontalAlignment.Left)
lstStatuses.Columns.Add("Date", 150, HorizontalAlignment.Left)
Try
For Each user As LC.User In users
Dim item As New ListViewItem(user.ScreenName)

item.SubItems.Add(user.Status.Text)
item.SubItems.Add(user.Status.CreatedTime)
item.Tag = user
lstStatuses.Items.Add(item)
Me.txtCurrent.Text = user.Status.Text
Me.LoadWebImageToPictureBox(PictureBox1, user.ProfileImageUrl)
Next
Catch ex As Exception
MessageBox.Show("Error: " & ex.Message)
End Try
lblUserName.Text = user1.Username
End Function
What I am asking is, I was wondering whether someone can show my how to use it and call it from a "Button_Click" event. I am quite experienced in VB, but I have never used a BackgroundWorker before.

Thanks.
 
 
 
Reply

Programming Languages Thread, Using BackgroundWorker in VB.NET in Programming , WebDesign & Development; I was wondering if someone could give me an example of how to use the BackgroundWorker component in VB.NET/Visual Studio. ...

Short Link: http://forum.egypt.com/enforum/showthread.php?t=30317


Bookmarks

Tags
backgroundworker, vbnet


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump