Page 152 - Open Soource Technologies 304.indd
P. 152

Event Driven Programming




























                          In the examples considered so far, the control variable was successively increased until it reached
                          the terminating value. However, if a negative step value is used and the initial value is greater
                          than the terminating value, then the control value is decreased until reaching the terminating
                          value. In other words, the loop counts backward or downward.


                                        3: The following program accepts a word as input and displays it backwards:




















                                   Object                  Property        Setting
                                   FrmBackwards            Text            Write Backwards
                                   LblWord                 AutoSize Text   False  Enter word:

                                   txtWord btnReverse      Text            Reverse Letters
                                   txtBackwards            ReadOnly        True
                          Private Sub btnReverse_Click(...) Handles btnReverse.Click
                            txtBackwards.Text = Reverse(txtWord.Text)
                          End Sub



                          146                    LOVELY PROFESSIONAL UNIVERSITY
   147   148   149   150   151   152   153   154   155   156   157