Page 32 - H - 資訊本
P. 32

【資訊本】                                                                             肆、活動運用
                          n = 0
                          free = 0
                          Dim s As String
                          Open "購票人.txt" For Input As #1
                              Do While Not EOF(1)
                                          n = n + 1
                                          Line Input #1, s
                                          If Left(s, 1) = "1" Then
                                                  ms = ms + 1
                                          ElseIf Left(s, 1) = "3" Then
                                                free = free + 1
                                          Else
                                                  nms = nms + 1
                                          End If
                                          p(n) = s
                              Loop
                          Close
                          Label2.Caption = "管院:" & ms
                          Label3.Caption = "非管院:" & nms
                          Label5.Caption = free
                          Label7.Caption = ms + nms + free
                          Label4.ForeColor = vbBlue
                          End Sub


                          Private Sub Form_Load()

                          Label4.Caption = "歡迎使用購票系統"
                          End Sub

                          Private Sub Option1_Click()
                          Text1.Enabled = True
                          Text1.Text = ""
                          Text1.SetFocus
                          End Sub

                          Private Sub Option2_Click()
                          Text1.Enabled = False
                          Text1.Text = "非管院生"
                          Command1.SetFocus
                          End Sub

                          Private Sub Option3_Click()
                          If Option2.Value = False Then Text1.SetFocus
                          End Sub

                          Private Sub Option4_Click()
                          If Option2.Value = False Then Text1.SetFocus
                          End Sub


                          Private Sub Text1_KeyPress(KeyAscii As Integer)
                          If KeyAscii = 13 Then Command1_Click
                          End Sub








                                                            29
   27   28   29   30   31   32   33   34   35   36   37