Question Error with code

Nouveaish

Member
Joined
Dec 3, 2012
Messages
10
Programming Experience
Beginner
VB.NET:
If (blnNumberOfFlowersIsValid And blnSeedIsSelected) Then
            intPacketSize = Convert.ToInt32(txtNumOfFlowers.Text)
            intSeedTypeChoice = cboSeedType.SelectedIndex
            Select Case intSeedTypeChoice
                Case 0
                    decTotalCost = AnnualSeedsAvailable(intSeedChoice, intPacketSize, intNumberOfSeeds)

                Case 1
                    decTotalCost = PerennialSeedsAvailable(intSeedChoice, intPacketSize, intNumberOfSeeds)
            End Select

            'Displays the cost of the seed packets

            lblSeed.Text = "Seed: " & strSelectedSeed
            lblCost.Text = "Cost: " & decTotalCost.ToString("C")
            lblNumberOfSeeds.Text = "Number of seeds: " & intNumberOfSeeds.ToString() & " seeds"
        End If

I keep getting an error saying that there are too many arguments for each case. What should I fix? I want the costs for all three to show up but my program won't run. This is my only error for the form. I had a different program where I listed all three ints and didn't get the same error.
 
For future reference, rather than just a vague description, please give us the exact error message and tell us exactly what line it occurs on. Otherwise we have to guess.

Presumably you're being told that you are passing too many arguments to your AnnualSeedsAvailable and PerrenialSeedsAvailable methods. The solution is simple: pass the correct number of arguments. How many parameters does each of those methods have? That's how many arguments you have to pass. If you believe that you have to pass additional dat then maybe you ought to think about rewriting those methods.
 
Back
Top