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

Unit 14: Building Small Application


               End If

               End If
               End Sub
               Lastly, the 1/x, or fraction, Click event, which is very similar to the
               code above:
               Private Sub btnFraction_Click()
               If sLeft <> “” Then

               iLeft = sLeft
               Else
               iLeft = 0
               End If
               If sRight <> “” Then
               iRight = sRight
               Else
               iRight = 0

               End If
               If bLeft Then
               iLeft = 1 / iLeft
               tbResult.Text = iLeft
               Else
               iRight = 1 / iRight
               tbResult.Text = iRight
               End If
               If iLeft <> 0 Then
               sLeft = iLeft

               Else
               sLeft = “”
               End If
               If iRight <> 0 Then
               sRight = iRight
               Else
               sRight = “”

               End If
               End Sub




                                      LOVELY PROFESSIONAL UNIVERSITY                        311
   312   313   314   315   316   317   318   319   320   321   322