A clever person solves a problem. A wise person avoids it.
- Einstein
News
Site News
Latest Comments
Affiliates
Proxies
Contribute!
Chat
Tutorials
Newest Articles
Most Popular
Highest Rated
Latest Comments
Code Samples
Newest Code
Most Popular
Highest Rated
Latest Comments
Blogs
Admins Blog
Newest Blogs
Most Popular
Highest Rated
Latest Comments
Forums
Latest Posts
Latest Topics
Memberlist
[login]
|
[Register]
Grade Calculator
by: bs0d
Description:
Another program to become more familiar about how Visual Basic works. Perform actions based on user input, calculate results using loops. Select case used and more. Check out the picture to see how it should look.
See Full Size
Code:
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
Comments:
kayegbenson
Subject:
"i need ur help please!!!!!!!!! ~~!~..."
Date:
Feb 27 2009 at 2:31 am
i need the properties for this
could you please post it as soon as possible
thank you
You Must be
signed in
or a
member
to comment.
Code Stats
30,349
Views
2
Total Comments
4
Rating of 5 (
1
Votes)
Code Options
·
Login to Rate This Code
·
Login to Post a Comment
·
Read more by this author
Related
·
RGB Color Fader
·
Adder
·
Math Problems
·
Cut and Paste
·
Combo Box Colors
·
Flag Viewer
"AllSyntax.com" Copyright © 2002-2021; All rights lefted, all lefts righted.
Privacy Policy