Page 68 - Programming VB.NET
P. 68

64                       Chapter 6: Procedures And Functions


               6.5 Independent Sub Procedure Application




               Add listbox and button to your form and type a code
               below.


                   Private Sub btngo_Click(ByVal sender As
                   System.Object, ByVal e As System.EventArgs)
                   Handles btngo.Click

                          lstoutput.Items.Add("Hello from GO
                   button")

                          lstoutput.Items.Add("Now I am calling
                          DisplayMessage procedure")
                         DisplayMessage()

                         lstoutput.Items.Add("Now I am back in
                   GO button")

                       End Sub


                   Sub DisplayMessage()

                     lstoutput.Items.Add("")

                     lstoutput.Items.Add("Hi from DisplayMessage
                   procedure")

                     lstoutput.Items.Add("")


                   End Sub
   63   64   65   66   67   68   69   70   71   72   73