"Sam" <sa**************@voila.fr> schrieb:
Private Function btnSave_Click(ByVal sender As System.Object, ByVal e
As
System.EventArgs) Handles btnSave.Click as Boolean
Of course this syntax is not correct but how can I make it work ?
Events cannot return values like function procedures. However, you if you
write your own events you can return values to the object raising the event
using custom event arguments:
\\\
Public Event Foo(ByVal sender As Object, ByVal e As FooEventArgs)
..
..
..
Protected Sub OnFoo(ByVal e As FooEventArgs)
RaiseEvent Foo(Me, e)
End Sub
..
..
..
Dim e As New FooEventArgs()
OnFoo(e)
If e.Handled Then
...
Else
...
End If
..
..
..
Private Sub Bla_Foo(ByVal sender As Object, ByVal e As FooEventArgs)
If...Then
e.Handled = True
End If
End Sub
..
..
..
Public Class FooEventArgs
Inherits EventArgs
Private m_Handled As Boolean
Public Property Handled() As Boolean
Get
Return m_Handled
End Get
Set(ByVal Value As Boolean)
m_Handled = Value
End Set
End Property
End Class
///
--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>