

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


Severance
Option Explicit Dim N65 As Integer Dim N10 As Integer Dim N25 As Integer Dim Number As Integer
Private Sub cmExecute_Click( ) Dim K As Integer Dim Weight As Integer Dim Random As Single
If Len(txt10.Text) > 0 Then If Len(txt25.Text) > 0 Then If Len(txt65.Text) > 0 Then If Len(txtNumber.Text) > 0 Then For K = 1 To Number Random = Rnd If Random > 0.25 Then If Random < 0.35 Then Weight = N Else Weight = N End If Else Weight = N End If lstBox.AddItem CStr(K) & " " & CStr(Weight) Next K Else MsgBox "There must be a number of iterations" txtNumber.SetFocus End If Else MsgBox "How many 65 pound boxes are there?" txt65.SetFocus End If Else MsgBox "How many 25 pound boxes are there?" txt25.SetFocus End If Else MsgBox "How many 10 pound boxes are there?" txt10.SetFocus End If
Private Sub cmdClear_Click( ) lstBox.Clear End Sub
Private Sub cmdExit_Click( ) End End Sub
Private Sub txt10_LostFocus( ) If Len(txt10.Text) > 0 Then If IsNumeric(txt10.Text) Then If Int(CSng(txt10.Text)) = CSng(txt10.Text) Then If CStr(txt10.Text) > 0 Then N10 = CInt(txt10.Text) Else MsgBox "There must be a positive number, please!" End If Else MsgBox "You can't have a fraction here!" End If Else MsgBox "Must be a numeric quantity, please!" End If End If End Sub
Private Sub txt25_LostFocus( ) If Len(txt25.Text) > 0 Then If IsNumeric(txt25.Text) Then If Int(CSng(txt25.Text)) = CSng(txt25.Text) Then If CStr(txt25.Text) > 0 Then N25 = CInt(txt25.Text) Else MsgBox "There must be a positive number, please!" End If Else MsgBox "You can't have a fraction here!" End If Else MsgBox "Must be a numeric quantity, please!" End If End If