C
CarpetMnuncher!
=================================================================
How do I use Try Catch error handling when a timer is involved?
If I preform the preciduer below and I get an error I revive
50,000,000,000,000,000, messageboxes..
example 1;
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button4.Click
Try
If Label13.Text = ("some text") = False Then
Button3.BackColor = System.Drawing.Color.FromArgb(CType(224,
Byte), CType(224, Byte), CType(224, Byte))
Button3.Text = ("some more text")
Timer5.Enabled = True '<<<<<<<<<<<< say this timer is error
free!
Timer6.Enabled = True '<<<<<<<<<<<< say this timer ha an error
and it kicks an exception error!
End If
Panel1.Visible = False
Catch ex As Exception
Dim proc As System.Diagnostics.Process
Dim pList() As Process
pList = Process.GetProcessesByName("some app")
For Each proc In pList
Dim resp As MsgBoxResult
resp = MsgBox("Error 0020 some error, Do you wish to Exit "
& proc.ProcessName & "?", _
MsgBoxStyle.YesNo, "app error")
If resp = MsgBoxResult.Yes Then
proc.Kill()
If resp = MsgBoxResult.No Then
Application.DoEvents()
End If
End If
Next
Exit Try
Finally
End Try
End Sub
If an exception error happens with the above code I get
50,0000,0000000000000,00000,000,0,0,00,,0,0,0,0,0,0,0,+1 messageboxes!
This next example works fine but it seames to me that it's overkill to have
too write my code twice, is ther another way to acoumplish the samething if
someone clickes NO???
Example 2;
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button4.Click
Try
If Label13.Text = ("some text") = False Then
Button3.BackColor = System.Drawing.Color.FromArgb(CType(224,
Byte), CType(224, Byte), CType(224, Byte))
Button3.Text = ("some more text")
Timer5.Enabled = True '<<<<<<<<<<<< say this timer is error
free!
Timer6.Enabled = True '<<<<<<<<<<<< say this timer ha an error
and it kicks an exception error!
End If
Panel1.Visible = False
Catch ex As Exception
Timer5.Enabled = False
Timer6.Enabled = False
Dim proc As System.Diagnostics.Process
Dim pList() As Process
pList = Process.GetProcessesByName("some app")
For Each proc In pList
Dim resp As MsgBoxResult
resp = MsgBox("Error 0020 some error, Do you wish to Exit "
& proc.ProcessName & "?", _
MsgBoxStyle.YesNo, "app error")
If resp = MsgBoxResult.Yes Then
proc.Kill()
If resp = MsgBoxResult.No Then
Application.DoEvents()
If Label13.Text = ("some text") = False Then
Button3.BackColor = System.Drawing.Color.FromArgb(CType(224,
Byte), CType(224, Byte), CType(224, Byte))
Button3.Text = ("some more text")
Timer5.Enabled = True '<<<<<<<<<<<< say this timer is error
free!
Timer6.Enabled = True '<<<<<<<<<<<< say this timer ha an error
and it kicks an exception error!
End If
Panel1.Visible = False
End If
End If
Next
Exit Try
Finally
End Try
End Sub
============================================================================
=
How do I use Try Catch error handling when a timer is involved?
If I preform the preciduer below and I get an error I revive
50,000,000,000,000,000, messageboxes..
example 1;
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button4.Click
Try
If Label13.Text = ("some text") = False Then
Button3.BackColor = System.Drawing.Color.FromArgb(CType(224,
Byte), CType(224, Byte), CType(224, Byte))
Button3.Text = ("some more text")
Timer5.Enabled = True '<<<<<<<<<<<< say this timer is error
free!
Timer6.Enabled = True '<<<<<<<<<<<< say this timer ha an error
and it kicks an exception error!
End If
Panel1.Visible = False
Catch ex As Exception
Dim proc As System.Diagnostics.Process
Dim pList() As Process
pList = Process.GetProcessesByName("some app")
For Each proc In pList
Dim resp As MsgBoxResult
resp = MsgBox("Error 0020 some error, Do you wish to Exit "
& proc.ProcessName & "?", _
MsgBoxStyle.YesNo, "app error")
If resp = MsgBoxResult.Yes Then
proc.Kill()
If resp = MsgBoxResult.No Then
Application.DoEvents()
End If
End If
Next
Exit Try
Finally
End Try
End Sub
If an exception error happens with the above code I get
50,0000,0000000000000,00000,000,0,0,00,,0,0,0,0,0,0,0,+1 messageboxes!
This next example works fine but it seames to me that it's overkill to have
too write my code twice, is ther another way to acoumplish the samething if
someone clickes NO???
Example 2;
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button4.Click
Try
If Label13.Text = ("some text") = False Then
Button3.BackColor = System.Drawing.Color.FromArgb(CType(224,
Byte), CType(224, Byte), CType(224, Byte))
Button3.Text = ("some more text")
Timer5.Enabled = True '<<<<<<<<<<<< say this timer is error
free!
Timer6.Enabled = True '<<<<<<<<<<<< say this timer ha an error
and it kicks an exception error!
End If
Panel1.Visible = False
Catch ex As Exception
Timer5.Enabled = False
Timer6.Enabled = False
Dim proc As System.Diagnostics.Process
Dim pList() As Process
pList = Process.GetProcessesByName("some app")
For Each proc In pList
Dim resp As MsgBoxResult
resp = MsgBox("Error 0020 some error, Do you wish to Exit "
& proc.ProcessName & "?", _
MsgBoxStyle.YesNo, "app error")
If resp = MsgBoxResult.Yes Then
proc.Kill()
If resp = MsgBoxResult.No Then
Application.DoEvents()
If Label13.Text = ("some text") = False Then
Button3.BackColor = System.Drawing.Color.FromArgb(CType(224,
Byte), CType(224, Byte), CType(224, Byte))
Button3.Text = ("some more text")
Timer5.Enabled = True '<<<<<<<<<<<< say this timer is error
free!
Timer6.Enabled = True '<<<<<<<<<<<< say this timer ha an error
and it kicks an exception error!
End If
Panel1.Visible = False
End If
End If
Next
Exit Try
Finally
End Try
End Sub
============================================================================
=