Message box sample

Hello world form                Hello world form



 

Compiling

Running

After launching the application, you will see a window displayed with a similar appearance to the one above.

Click on the BUTTON "Click Me!" and a message box will appear with the text that you have entered in the TEXT_FIELD.

 

Under the Hood

The application shows how to use the very useful MESSAGE_BOX control.

An event (EVENT_HANDLER) is associated to a control (here to the BUTTON). So the line

my_button.add_click (create {EVENT_HANDLER}.make (Current, $on_my_button_clicked ))
associates a click to my_button to the feature on_my_button_clicked. So every time the BUTTON my_button is clicked, the feature on_my_button_clicked is executed.

The feature my_button_clicked displays a MESSAGE_BOX (feature {WINFORMS_MESSAGE_BOX}.show (msg)) with the text contained in TEXT_FIELD (msg := my_text_field.text).

This sample contains the following class:

Notes

This sample is translated from the example located in the QuickStart\winforms\samples\accessible subdirectory of the .NET Framework SDK samples directory of Microsoft Visual Studio .NET.