Visual Studio Modulus Operator

Robert Ehinger
Robert Ehinger used Ask the Experts™
on
I am having a bit of a struggle with the Modulus operator in Visual Studio. Here is the code for a small program I have written that is not running as it should. Please Advise.

Public Class frmMain

    Private Sub btnExit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnExit.Click
        Me.Close()
    End Sub

    Private Sub btnCalculate_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnCalculate.Click
        'Calculate and display the number of filled vans and the number of people left without a ride

      lblVans.Text = Val(txtPeople.Text) \ Mod 10
    End Sub
End Class

Thank you!!
Robert
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Top Expert 2010

Commented:
Seems to me that You have a typo

lblVans.Text = Val(txtPeople.Text) \ Mod 10

What do You want to acheive? \ and Mod side by side is not good.
Robert EhingerIT specialist

Author

Commented:
Trying to have a small application to display how many vans we will need for transporting people to functions and how many will be left needing other transportation. So there needs to be two numeric outputs displayed.
Top Expert 2010
Commented:
number_of_vans = Val(txtPeople.Text) \ 10
rest_of_people =  Val(txtPeople.Text) Mod 10

Assuming that there can be 10 people in the Van.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial