Wednesday, February 9, 2011

Visual Basic 6.0 - Session 8

Create a new form and link to iteration — pre-test (- Count the beeps) on the Main menu.  Add a text box and a command button.  Put a label above the text box asking the user to input a number between 1 and 10.  When the user clicks the command button, check the textbox for a valid number and issue an error message if the number isn’t inside the expected range.  If the number is valid, use Do While    ……    Loop to issue that
number of beeps. Name your form frmBeeper.


PrivateSubCommand1_Click()
   Dim intNumber As Integer
   Dim pause As Integer
   intNumber = Val(Text1.Text)
   If(intNumber>0)And(intNumber<11)Then
      Do While intNumber>0
         Beep
         Forpause=0To2500
         frmBeeper.Refresh
      Nextpause
      intNumber = intNumber-1
      Loop
   Else
   Text1.Text=""
   Text1.SetFocus
   EndIf
EndSub

Write an IPO Chart for this program.

Then write the pseudocode algorithm for this program.

No comments:

Post a Comment