Results 1 to 15 of 15

Thread: [RESOLVED] Listbox and counter errors...

Threaded View

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Nov 2015
    Location
    Wilmington,NC
    Posts
    72

    Resolved [RESOLVED] Listbox and counter errors...

    So my program is suposed to prompt me for 5 integers. these 5 will be added together and produce an average I also need to put a Letter grade, in a label for the average of the 5 numbers.(this idk how to do)
    these 5 must be between 0-100 and I'm just lost...i built a program like this before with weight loss but I'm aslo smashed with python can you guys help me out with where some errors are? I'm just crammed and i keep confusing the 2 languages that i'm just now learning.
    Code:
    'Program Name: Grade Book
    'Dev: Bryan Cruse
    'Date:11/24/15
    
    Option Strict On
    
    
    
    
    Public Class frmGradeBook
        Dim intGrades As Integer
        Dim IntNumberOFentries As Integer = 1
        Dim StrGrades As String
        Dim decFinalGrades As Decimal
        Dim intMaxNumberOfEntries As Integer = 5
        Dim StrInputMessage As String = "Please enter your grade"
        Dim StrInputHeading As String = "Grade Book"
        Dim StrNormalMessage As String
    
    
    
        Private Sub mnuExitProgramItem_Click(sender As Object, e As EventArgs) Handles mnuExitProgramItem.Click
            Close()
        End Sub
    
        Private Sub mnuClearGradesItem_Click(sender As Object, e As EventArgs) Handles mnuClearGradesItem.Click
            lstGrades.Items.Clear()
    
        End Sub
    
        Private Sub btnEnterGrades_Click(sender As Object, e As EventArgs) Handles btnEnterGrades.Click
    
            Dim strCancelClicked As String = ""
            StrGrades = InputBox("Please Enter your grades", "Grade Book", )
    
    
            Do Until IntNumberOFentries > intMaxNumberOfEntries Or StrGrades = strCancelClicked
    
    
              
    
                If IsNumeric(StrGrades) Then
                    intGrades = CInt(Convert.ToDecimal(StrGrades))
    
                    If intGrades > 100 Then
                        MsgBox("Please enter a valid grade.", MsgBoxStyle.Exclamation, "Grade Book")
                        If intGrades > 0 Then
                        Else : MsgBox("You entered a non usable number", , "Input Error")
                        End If
                        lstGrades.Items.Add(intGrades)
                        decFinalGrades += intGrades
                        IntNumberOFentries += 1
                        StrInputMessage = strNormalMessage
                        If IntNumberOFentries >= intMaxNumberOfEntries Then
                            StrGrades = InputBox(StrInputHeading & IntNumberOFentries, StrInputHeading, " ")
                        End If
                    End If
                End If
            Loop
    
            lstGrades.Items.Add(intGrades)
    
            If IntNumberOFentries <= 5 Then
                lblScore.Visible = True
                decFinalGrades = CDec(intGrades / 7)
                If decFinalGrades <= 68 Then
                    lblGrade.Text = "F"
                End If
            End If
    
                End While
    
    
        End Sub
    End Class
    Last edited by ItsBryanTho; Dec 14th, 2015 at 01:51 PM. Reason: clarity

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width