P
pamelafluente
Hi guys,
After the Exception question, I have another one, strictly related.
I would also like what is your preferred device
to bubble a message (not by exception) to the user Interface.
Assume for instance the following simple schema. What is the best way
to bubble the "Status" string message to the UI ? Please suggest
appropriate
code changes.
I guess that different programmers might have different ideas on how to
that
in the most flexible way ...
-P
'--------------------------------- SAMPLE CODE -----------------------
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Try
With New SomeProcessor
.SomeTask()
' I want for instance the "Status" issued by SomeOtherTask
' to be appended to a TextBox on this User Interface
' What's the best way to bubble the message here
End With
Catch ex As Exception
Me.RichTextBox1.AppendText(ex.Message)
End Try
End Sub
End Class
'The following is in separate files
Class SomeProcessor
Sub SomeTask()
With New SomeOtherProcessor
Try
.SomeOtherTask()
Catch ex As Exception
Throw
End Try
End With
End Sub
End Class
Class SomeOtherProcessor
Sub SomeOtherTask()
Try
Dim Status As String = "This operation was successful"
Catch ex As Exception
Throw
End Try
End Sub
End Class
After the Exception question, I have another one, strictly related.
I would also like what is your preferred device
to bubble a message (not by exception) to the user Interface.
Assume for instance the following simple schema. What is the best way
to bubble the "Status" string message to the UI ? Please suggest
appropriate
code changes.
I guess that different programmers might have different ideas on how to
that
in the most flexible way ...
-P
'--------------------------------- SAMPLE CODE -----------------------
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Try
With New SomeProcessor
.SomeTask()
' I want for instance the "Status" issued by SomeOtherTask
' to be appended to a TextBox on this User Interface
' What's the best way to bubble the message here
End With
Catch ex As Exception
Me.RichTextBox1.AppendText(ex.Message)
End Try
End Sub
End Class
'The following is in separate files
Class SomeProcessor
Sub SomeTask()
With New SomeOtherProcessor
Try
.SomeOtherTask()
Catch ex As Exception
Throw
End Try
End With
End Sub
End Class
Class SomeOtherProcessor
Sub SomeOtherTask()
Try
Dim Status As String = "This operation was successful"
Catch ex As Exception
Throw
End Try
End Sub
End Class