9Mcode comment |
|
|
|
|
|
|
- - - - - - - - - - - - - - ผู้ให้การสนับสนุน- - - - - - - - - - - - - -
|
|
|
กระทู้ #1752 [Vb] (จาก IP: 203.158.221.227)
เขียนโปรแกรม คิดเกรดเฉลี่ย
ผมขอ sourcecode. คิดเกรดเฉลี่ยหน่อยครับ
|
จากคุณ
:
boy / jumloonk@hotmail.com [2008-01-22 18:28:42]
|
|
ความคิดเห็น #26456 (จาก IP: 58.8.182.209)
Private Sub chkDone_Click(Index As Integer) Dim intCount As Integer, strChecked As String
If chkDone(Index).Value = vbChecked Then cmdDisplay.Enabled = True txtScore(Index).Enabled = True txtScore(Index).SetFocus Else txtScore(Index).Text = 0 txtScore(Index).Enabled = False strChecked = "N" Do While intCount <= 4 And strChecked = "N" If chkDone(intCount).Value = vbChecked Then strChecked = "y" End If intCount = intCount + 1 Loop If strChecked = "n" Then cmdDisplay.Enabled = False End If End If End Sub
Private Sub cmdClear_Click() Dim x As Integer
For x = 0 To 4 chkDone(x).Value = False txtScore(x).Text = "" Next x
lblGrade.Caption = "" txtName.SetFocus
End Sub
Private Sub cmdDisplay_Click() Dim intEarned As Integer, intPossible As Integer Dim sngRatio As Single, intCount As Integer For intCount = 0 To 4 If chkDone(intCount).Value = vbChecked Then intEarned = intEarned + Val(txtScore(intCount).Text) Select Case intCount Case 0 To 2 intPossible = intPossible + 10 Case Else intPossible = intPossible + 50 End Select End If Next intCount sngRatio = intEarned / intPossible Select Case sngRatio Case Is >= 0.9 lblGrade.Caption = "A" Case Is >= 0.8 lblGrade.Caption = "B" Case Is >= 0.7 lblGrade.Caption = "C" Case Is >= 0.6 lblGrade.Caption = "D" Case Else lblGrade.Caption = "F" End Select End Sub
Private Sub cmdExit_Click() Unload frmGrade
End Sub
Private Sub cmdPrint_Click() PrintForm End Sub
Private Sub Form_Load() frmGrade.Top = (Screen.Height - frmGrade.Height) / 2 frmGrade.Left = (Screen.Width - frmGrade.Width) / 2 End Sub
Private Sub Form_Unload(Cancel As Integer) Const conBtns As Integer = vbYesNo + vbExclamation + vbDefaultButton1 + vbApplicationModal Dim intUserResponse As Integer
intUserResponse = MsgBox("Do you want to exit?", conBtns, "Grade Application") If intUserResponse = vbNo Then 'User does not want to quit the app Cancel = 1 'prevent form unload. End If
End Sub
Private Sub txtScore_GotFocus(Index As Integer) txtScore(Index).SelStart = 0 txtScore(Index).SelLength = Len(txtScore(Index).Text) End Sub |
จากคุณ
:
sup98 [2008-01-22 21:43:32]
|
|
|
- - - - - - - - - - - - - - ผู้ให้การสนับสนุน- - - - - - - - - - - - - -
|
|
|
|
|
|
|