Nate
asked on
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...
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
ASKER
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.
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.
ASKER
Thank you for your assistance...
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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.
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.
have a look at my article on the BackgroundWorker component: http://emoreau.com/Entries/Articles/2006/12/The-BackgroundWorker-component.aspx
ASKER
Everything I've seen online tells me to use e.backgroundworker, thank you.
>>Everything I've seen online tells me to use e.backgroundworker
Maybe it was responding to a different event.
Maybe it was responding to a different event.
~bp