Can anyone translate this into VB.NET: <script runat="server"> public class Book { private string title; private int isbn; private decimal price; public Book() { title = "Beginning ASP.NET using C#"; isbn = 1861006152; } public string TitleInfo { get { return
title + " [ISBN: " + isbn + "]"; } } public string Title { get { return title; } } public int Isbn { get { return isbn; } } public decimal Price { get { return price; } set { price = value; } } } void Page_Load() { Book MyBook = new Book(); Response.Write("new
book 'MyBook' created."); MyBook.Price = 39.99m; Response.Write("
Title info: " + MyBook.TitleInfo); Response.Write("
Price " + MyBook.Price + "
"); } </script>
Public Class Book
Private title As String
Private isbn As Integer
Private price As Decimal
Public Sub New()
title = "Beginning ASP.NET using C#"
isbn = 1861006152
End Sub 'New
Public ReadOnly Property TitleInfo() As String
Get
Return title + " [ISBN: " + isbn + "]"
End Get
End Property
Public ReadOnly Property Title() As String
Get
Return title
End Get
End Property
Public ReadOnly Property Isbn() As Integer
Get
Return isbn
End Get
End Property
Public Property Price() As Decimal
Get
Return price
End Get
Set
price = value
End Set
End Property
End Class 'Book
Sub Page_Load()
Dim MyBook As New Book()
Response.Write("new book 'MyBook' created.")
MyBook.Price = 39.99D
Response.Write("
Title info: " + MyBook.TitleInfo)
Response.Write("
Price " + MyBook.Price + "
")
End Sub 'Page_Load
generalbc
Member
10 Points
2 Posts
Translate C# into VB.NET
Sep 19, 2003 01:51 PM|LINK
Title info: " + MyBook.TitleInfo); Response.Write("
Price " + MyBook.Price + "
"); } </script>
njNET
Member
195 Points
39 Posts
Re: Translate C# into VB.NET
Sep 19, 2003 02:00 PM|LINK
Public Class Book Private title As String Private isbn As Integer Private price As Decimal Public Sub New() title = "Beginning ASP.NET using C#" isbn = 1861006152 End Sub 'New Public ReadOnly Property TitleInfo() As String Get Return title + " [ISBN: " + isbn + "]" End Get End Property Public ReadOnly Property Title() As String Get Return title End Get End Property Public ReadOnly Property Isbn() As Integer Get Return isbn End Get End Property Public Property Price() As Decimal Get Return price End Get Set price = value End Set End Property End Class 'Book Sub Page_Load() Dim MyBook As New Book() Response.Write("new book 'MyBook' created.") MyBook.Price = 39.99D Response.Write(" Title info: " + MyBook.TitleInfo) Response.Write(" Price " + MyBook.Price + " ") End Sub 'Page_Loadhttp://www.kennyrice.com
generalbc
Member
10 Points
2 Posts
Re: Translate C# into VB.NET
Sep 19, 2003 02:11 PM|LINK
tmi
Member
10 Points
2 Posts
Re: Translate C# into VB.NET
Sep 19, 2003 02:32 PM|LINK