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

gradeCounter is defined as Integer.

Try:
If(gradeCounter = 0)...

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

From the code snippet provided, it seems that there is a problem with the placement of the message box. Currently, the message box is located within the if-else statement, specifically within the "else" part, which is empty. This means that the message box will never be displayed because there is no code within the else statement.

To fix this, you need to move the message box code outside of the else statement. It should be placed after the end of the if-else statement.

Here's the modified code:

```vb
If (gradeCounter = " ") Then
MessageBox.Show( _
"There are not any grades entered", _
"Average cannot be divided by zero", MessageBoxButtons.OK, _
MessageBoxIcon.Error)
Else
' Code for other operations if any
End If
```

Make sure to replace MessageBoxShow with MessageBox.Show as the correct method call for displaying a message box. Also, ensure that you are passing the appropriate parameters to the MessageBox.Show method, including the correct button type (MessageBoxButtons.OK) and icon type (MessageBoxIcon.Error) for the desired message box appearance.