comp • gb.web.form • message

Message (gb.web.form)

This class is static.
This class can be used as a static function.

Static properties

Static methods
Name   Error   Info   Question   Warning  

This class allows to display a message box in a web form.

Since gb.web.form does not allow any user (i.e. browser) interaction inside a Request, this Message function does not return a value like the gb.form Message function does.

The trick to acting upon whichever message button the user clicked is the following: any control raises a "Message" event when a message box has been opened from one of its event handlers.

It works like this:

' The remove button Click handler that opens the message box.
Public Sub btnRemove_Click()
Message.Question(("Do you really want to remove this file?"), ("Cancel"), ("Remove"))
' Execution continues here. The message box will be opened by the
' browser when the request is returned to it.
' You can even open other message boxes. But it's not a good idea.
' The Message event that gets the message box answer.
Public Sub btnRemove_Message((Source) As WebControl, Action As String)
If Action = ("Remove") Then
    ' Remove the thing
    Message.Error("Unable to remove this thing!")

You should note that there is another message in the btnRemove_Message() method. It will call the btnRemove_Message() again! So you must be careful to differentiate between the answers of the different message boxes.