Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

.NET 

VB.net Maximum won't display

Hello, I'm just doing a small project I need to do for my computing class (It's very basic, sorry) and I'm having a problem with something (which I find embarrassing as to how basic it is.

This is what my code looks like :

Code
Private Sub Verify(ByRef group, ByVal rating, ByVal names, ByVal telephone)
        Dim counter As Integer
        For counter = 1 To 3
        Do
        names(counter) = InputBox("Please enter your name")
        If names(counter) = "" Then
            MsgBox ("Please enter your name")
        End If
        Loop Until names(counter) <> ""
        Do
        telephone(counter) = InputBox("Please enter your telephone number")
        If telephone(counter) = "" Then
            MsgBox ("Please enter your telephone number")
        End If
        Loop Until telephone(counter) <> ""
        Do
        group(counter) = InputBox("Please enter your group size (0-20)")
        If group(counter) > 20 Then
            MsgBox ("Please enter a group size between 0 and 20")
        End If
        Loop Until group(counter) < 20
        Do
        rating(counter) = InputBox("Please enter your group rating (0-10)")
        If rating(counter) > 10 Then
            MsgBox ("Please enter a rating between 0 and 10")
        End If
        Loop Until rating(counter) < 10
        Next counter
        Call max(maximum, group)
        Call Display(group, rating, names, telephone)
        End Sub
    
    Private Sub max(ByRef maximum, ByRef group)
        maximum = 0
        For counter = 1 To 3
        If group(counter) > maximum Then
        maximum = group(counter)
        End If
        Next counter
    End Sub
    
    Private Sub Display(ByVal group, ByVal rating, ByVal names, ByVal telephone)
        For counter = 1 To 3
        PictureDisplay.Print ("Name: " & names(counter))
        PictureDisplay.Print ("Telephone Number: " & telephone(counter))
        PictureDisplay.Print ("Group Size: " & group(counter))
        PictureDisplay.Print ("Group Rating: " & rating(counter))
        Next counter
        PictureDisplay.Print ("Maximum group size: " & maximum)
        Call ask
    End Sub

However, the maximum value is not displaying, instead just the last value that was entered. What am I doing wrong here?
Well first of, at the very top of your page, BEFORE all your imports, put this:

Code
Option Strict On
(Nov 14, 2013 11:41 AM)tweety Wrote:  Well first of, at the very top of your page, BEFORE all your imports, put this:

Code
Option Strict On

Do you know how I can solve my problem though?


Possibly Related Threads...
Thread / Author Replies Views Last Post
[Shell] by Emre_Nov 3, 2020 10:03 AM 2 217 Nov 3, 2020 10:03 AM
Last Post: Emre_
[Python] by SIM-1866423Apr 28, 2020 02:59 PM 0 96 Apr 28, 2020 02:59 PM
Last Post: SIM-1866423
[.NET] by Tɦɛ AlexDec 22, 2015 12:46 PM 2 335 Dec 22, 2015 12:46 PM
Last Post: Tɦɛ Alex