Private m_elapsedMileage as integer
And then create a public property called ElapsedMileage:
Public Property ElapsedMileage() as integer Get () as integer return 5 End Get Set (ByVal Value as integer) ' Do nothing End Set End Property
First, did you notice how the IDE completed the structure of the Property statement for us? We can still modify it, but it is a nice convenience that the IDE gives us.
Second, notice that there are two distinct parts of the Property statement ... a Get and a Set. The Get retrieves and returns a value to the code that calls it. The Set assigns a Value. Note that the Property statement does nothing by itself; we have to decide which value to return when the Get statement is called and what to do with the Value that is passed into the parameter of the Set statement. We could ignore these values, "hard code" them, or whatever we like. Typically, we'll do this:
Supplemental Readings for the Express Edition Videos Copyright © 2005 LearnVisualStudio.NET