O'Reilly logo

ASP.NET for Web Designers by Peter Ladka

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Visual Basic .NET Example

This section takes the ball class from Chapter 2 and compiles it as an object that will be available to the ASP.NET application.

Here is the ball class.

ball_vb.vb
Namespace Peter.Toybox 
    Public Class Ball 
        Private _Color as String 
        Private _Motion as String 

        Public Sub New() 
            _Motion = "Still" 
        End Sub 

        Public Property Color as String 
            Get 
                Return _Color 
            End Get 
            Set 
                _Color = value 
            End Set 
        End Property 

        Public ReadOnly Property Motion as String 
            Get 
                Return _Motion 
            End Get 
        End Property 

        Public Sub Roll() 
            _Motion="Rolling" 
        End Sub 
    End Class 
End Namespace 

Enter this source example into your favorite text editor and save this as ball_vb.vb.

After you have the file saved, you can try to compile it. On my machine, the files are saved ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required