visual basic

posted by cl

Cant get my message dialog box to display anbody see waht wrong with it? The message box is located in my if then else statement

Dim total As Integer = 0
Dim gradeCounter As Integer = 0
Dim grade As Integer = 0
Dim average As Double = 0

' sum grades in ListBox
' read grade from ListBox
grade = gradesListBoxItemsItem(gradeCounter)
total += grade ' add grade to total
gradeCounter += 1 ' increment counter

Loop Until gradeCounter = gradesListBoxItemsCount()

average = total / gradesListBoxItemsCount() ' calculate average
averageResultLabel.Text = String.Format("{0:F}", average)
addButtonEnabled = True ' enable Add Grade Button
gradeTextBoxFocus() ' reset focus to Enter grade: TextBox

If (gradeCounter = " ") Then
MessageBoxShow( _
"There are not any grades entered", _
"Average can not be divided by zero", MessageBoxButtonsOK, _

End If

  1. Quidditch

    gradeCounter is defined as Integer.
    If(gradeCounter = 0)...

  2. RickP

    In VB, you should use OPTION EXPLICIT whenever possible in order to let the 'compiler' endorce strong typing.

Respond to this Question

First Name

Your Answer

Similar Questions

  1. programming

    I am supposed to modify this program so it begins by asking the user for the number of values. The program then uses a loop to read the specified number of values and then display their average. program is below that i worked on in …
  2. programming

    write a program that maintains two parallel arrays. after th arrays have been loaded the program should behave as a login screen prompting for username and password. the program should respond three output messages. if username does …
  3. visual basic

    Im trying to get this program to average three number having a problem the sample nmubers im using are 6 6 2 average supposed to be 4.6667 but im just geting .6667 I think it has something to do with my s=value(i) not sure what i need …
  4. visual basic

    Program that i am having trouble with having hard time how to figure out to assign non-zero digit to a variable! Create a variable first as integer  Assign first non‐zero digit of your V‐number to the variable first  …
  5. Programming

    Write a program that allows the user to display a budget as a pie chart. After the user enters numbers into the four text boxes a presses the button, the pie chart should be displayed. When I push the button for my code it does not …
  6. Visual Basic

    what does IntTemp and IntRem mean? and whats wrong with my code, i don't know whats wrong with it... Code below: Dim intNum As Integer 'the numderator is read as a whole number. Dim intDenom As Integer 'the denominator is read as a
  7. Programming (Visual Basic)

    Im seem to be having trouble with this Exercise. Would you mind helping me please?
  8. comptuer programming

    i need help with my code i keep comin up with errors in basic Dim Firstname as string Dim Lastname as string Dim Empnum As Integer Dim HourRate As Integer Dim Hours As Integer Dim Tools As Integer Dim Total As Integer Dim Netpay As …
  9. CS 116 Visual Basic

    I am having a problem I need to Rewrite the program so input, processing, and output are each performed by calls to Sub procedures. Private Sub btnCompute_Click(...) Handles btnCompute.Click ‘Information about trees Dim num As Integer …
  10. Visual Basic

    how to use formula b=p (1+r)^n, to calculate annual interests for a savings account in visual basic project This is my code so far>>>>>>>>>>>>>> Option Explicit On Option Strict On Option Infer …

More Similar Questions