VB Code question

Please forgive me for asking simple questions, I am just getting into programming VB...

I am trying to create a VB program but I am having a tremendous amount of difficulty with it. I keep getting 'Backgroundworker1' is not a member of System.EventArgs

I have searched and nothing I find it helpful to me.

If anyone needs me to attach a zip file containing the source, I can but this is the code I'm using...

Public Class Form1

    Dim sys_running As Integer

    Private Sub BackgroundWorker1_DoWork(sender As Object, e As System.ComponentModel.DoWorkEventArgs) Handles BackgroundWorker1.DoWork
        If sys_running = 0 Then
            sys_running = 1
            StartBtn.Text = "Stop"
        ElseIf sys_running = 1 Then
            sys_running = 0
            StartBtn.Text = "Start"
        End If
        Do Until sys_running = 0
            If Keep_Alive.Checked = True Then
                keepalive()
            End If
            If Log_Check.Checked = True Then
                'do something here
            End If
            If Kick_Stop.Checked = True Then
                'Kick Stop
            End If
            If Auto_SS.Checked = True Then
                'Auto-Start/Stop
            End If
        Loop

    End Sub

    Private Sub StartBtn_Click(ByVal sender As Object, ByVal e As EventArgs) Handles StartBtn.Click
        e.BackgroundWorker1.runworkasync()
    End Sub
    Private Sub keepalive()

    End Sub
End Class

Open in new window

NateAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Bill PrewCommented:
You marked this as VBSCRIPT, but it looks more like VB.net or VBA.  What environment are you working with?

~bp
0
NateAuthor Commented:
That's how new I am, I do not know which... I thought VB was VB....

I am using Visual Studio 2013

When I start "New Project" it says "Visual Basic" and then "Windows Forms Application" with a little "VB" on it.
0
NateAuthor Commented:
Thank you for your assistance...
0
Introducing Cloud Class® training courses

Tech changes fast. You can learn faster. That’s why we’re bringing professional training courses to Experts Exchange. With a subscription, you can access all the Cloud Class® courses to expand your education, prep for certifications, and get top-notch instructions.

AndyAinscowFreelance programmer / ConsultantCommented:
Assuming you have a backgroundworker object called BackgroundWorker1 then just changing:
    Private Sub StartBtn_Click(ByVal sender As Object, ByVal e As EventArgs) Handles StartBtn.Click
        e.BackgroundWorker1.runworkasync()
    End Sub

Open in new window

to:
    Private Sub StartBtn_Click(ByVal sender As Object, ByVal e As EventArgs) Handles StartBtn.Click
        BackgroundWorker1.RunWorkerAsync()
    End Sub

Open in new window

should cure your problem
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Jacques Bourgeois (James Burger)PresidentCommented:
If you are using Visual Studio, you are using VB.NET. Although it uses the same syntax, this is different from VB6, VBA or VBScript.

Remove the e. in front of e.BackgroundWorker1.

e is a parameter passed to the event. It is useful in some event to get information and pass back information to the system. but is useless in a Click event.

Assuming that your BackgroundWorker is in the same Form as the Button that triggers the Click, simply call you BackgroundWorker without any prefix.

And if I were you, because you are just beginning, I would try to work with simpler objects. The BackgroundWorker is not an easy object to work with.
0
Éric MoreauSenior .Net ConsultantCommented:
have a look at my article on the BackgroundWorker component: http://emoreau.com/Entries/Articles/2006/12/The-BackgroundWorker-component.aspx
0
NateAuthor Commented:
Everything I've seen online tells me to use e.backgroundworker, thank you.
0
AndyAinscowFreelance programmer / ConsultantCommented:
>>Everything I've seen online tells me to use e.backgroundworker

Maybe it was responding to a different event.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.