visual basic

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
Do
' 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, _
MessageBoxIconError)
Else

End If

asked by cl
  1. gradeCounter is defined as Integer.
    Try:
    If(gradeCounter = 0)...

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

    posted by RickP

Respond to this Question

First Name

Your Response

Similar Questions

  1. English

    Hello. Please tell me if it's possible to say: 1) to declare a message; 2) to announce a message; 3) to sound a message; 4) to voice a message; 5) to present a message; (for example, Diplomats ... a message from the United
  2. Healthcare Management

    Communication has been successful when the A. message has been understood. B. message has been transmitted. C. message has been received. D. recipient acknowledges receiving the message. A
  3. COM 215 written communication

    I need to write an informative message,positive message,negative message, and persuasive message. any suggestions??? These have to be business related
  4. intro to computer programming

    I need help with my Java homework! Write a program that calculates a customer's monthly bill. It should ask the user via dialog box to enter the letter of the package the customer has purchased (A, B, or C) and the number of hours
  5. psychology

    Whether you're persuaded by a message will primarily depend on which factor? a.) your preception understanding of the recipient of the message b.) your characteristics, including your personality and intelligence c.) whether your
  6. Basic programming principles

    The user wants to display a message a fixed number of times, if you know the message and the number of times (number) it must be displayed what would be the for statement, will this be correct or incorrect ONLY indicate correct or
  7. history

    What vital right did the Spanish allow the Western farmers? Answer: It was that Spain allowed Americans to travel on the lower Mississippi to New Orleans and to ship their goods. "cORRECT right??" mmhmm Can you help me out with
  8. Technical Communication

    Which of the following statements about a message’s meaning is true? The meaning of a message resides in the document, presentation, or visual that is created. Attitudes, education, experience, and contexts shape interpretations
  9. Literature and Social Studies--Please, help me!

    1. How does the song's (Pride by Bono and The Edge) message relate to King's message in "I Have a Dream"? A: The song's message relates to the King's message in his infamous "I Have a Dream" speech as it is about nonviolence and
  10. Literature--Please, help me!

    How does the song's (Pride by Bono and The Edge) message relate to King's message in "I Have a Dream"? A: The song's message relates to the King's message in his infamous "I Have a Dream" speech as it is about nonviolence and

More Similar Questions