gracias Rootk, ahora tengo esto, ya lo arregle...
Código HTML:
<script runat="server">
Public Class Bicicleta
Public Modelo as String
Public Precio as Double
Public NumeroDeVelocidades as Integer
Private Velocidad as Integer
Public Sub Acelerar(ByVal km As Integer)
Velocidad = Velocidad + km
End Sub
Public Sub Frenar()
If Velocidad > 0 Then
Velocidad = Velocidad -1
End If
End Sub
Public Function ConsultarVelocidad() As Integer
Return Velocidad
End Function
End Class
Dim objBicicleta as Bicicleta = New Bicicleta
Dim VelocidadActual as Integer
objBicicleta.Modelo = "Montaña"
objBicicleta.Precio = 200
objBicicleta.NumeroDeVelocidades = 21
objBicicleta.Acelerar(5)
objBicicleta.Frenar()
VelocidadActual = objBicicleta.ConsultarVelocidad()
Response.write VelocidadActual
</script>
Pero me arroja este error: ... espero me puedas ayudar, porque no encuentro la razon, muchas gracias
Código HTML:
Server Error in '/' Application.
--------------------------------------------------------------------------------
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: BC30188: Declaration expected.
Source Error:
Line 25:
Line 26: Dim VelocidadActual as Integer
Line 27: objBicicleta.Modelo = "Montaña"
Line 28: objBicicleta.Precio = 200
Line 29: objBicicleta.NumeroDeVelocidades = 21
Source File: c:\inetpub\wwwroot\pruebas\aspnet\test.aspx Line: 27
Show Detailed Compiler Output:
C:\WINNT\system32> "c:\winnt\microsoft.net\framework\v1.1.4322\vbc.exe" /t:library /utf8output /R:"c:\winnt\assembly\gac\system.enterpriseservices\1.0.5000.0__b03f5f7f11d50a3a\system.enterpriseservices.dll" /R:"c:\winnt\assembly\gac\system.data\1.0.5000.0__b77a5c561934e089\system.data.dll" /R:"c:\winnt\assembly\gac\system.drawing\1.0.5000.0__b03f5f7f11d50a3a\system.drawing.dll" /R:"c:\winnt\assembly\gac\system.web.mobile\1.0.5000.0__b03f5f7f11d50a3a\system.web.mobile.dll" /R:"c:\winnt\assembly\gac\system.xml\1.0.5000.0__b77a5c561934e089\system.xml.dll" /R:"c:\winnt\assembly\gac\system.web.services\1.0.5000.0__b03f5f7f11d50a3a\system.web.services.dll" /R:"c:\winnt\assembly\gac\system\1.0.5000.0__b77a5c561934e089\system.dll" /R:"c:\winnt\assembly\gac\system.web\1.0.5000.0__b03f5f7f11d50a3a\system.web.dll" /out:"C:\WINNT\Microsoft.NET\Framework\v1.1.4322\Temporary ASP.NET Files\root\2135a508\8d69a834\smtkbgrj.dll" /debug- "C:\WINNT\Microsoft.NET\Framework\v1.1.4322\Temporary ASP.NET Files\root\2135a508\8d69a834\smtkbgrj.0.vb"
Microsoft (R) Visual Basic .NET Compiler version 7.10.3052.4
for Microsoft (R) .NET Framework version 1.1.4322.573
Copyright (C) Microsoft Corporation 1987-2002. All rights reserved.
c:\inetpub\wwwroot\pruebas\aspnet\test.aspx(27) : error BC30188: Declaration expected.
objBicicleta.Modelo = "Montaña"
~~~~~~~~~~~~
c:\inetpub\wwwroot\pruebas\aspnet\test.aspx(28) : error BC30188: Declaration expected.
objBicicleta.Precio = 200
~~~~~~~~~~~~
c:\inetpub\wwwroot\pruebas\aspnet\test.aspx(29) : error BC30188: Declaration expected.
objBicicleta.NumeroDeVelocidades = 21
~~~~~~~~~~~~
c:\inetpub\wwwroot\pruebas\aspnet\test.aspx(31) : error BC30188: Declaration expected.
objBicicleta.Acelerar(5)
~~~~~~~~~~~~
c:\inetpub\wwwroot\pruebas\aspnet\test.aspx(32) : error BC30188: Declaration expected.
objBicicleta.Frenar()
~~~~~~~~~~~~
c:\inetpub\wwwroot\pruebas\aspnet\test.aspx(34) : error BC30188: Declaration expected.
VelocidadActual = objBicicleta.ConsultarVelocidad()
~~~~~~~~~~~~~~~
c:\inetpub\wwwroot\pruebas\aspnet\test.aspx(36) : error BC30188: Declaration expected.
Response.write VelocidadActual
~~~~~~~~
Show Complete Compilation Source:
Line 1: '------------------------------------------------------------------------------
Line 2: ' <autogenerated>
Line 3: ' This code was generated by a tool.
Line 4: ' Runtime Version: 1.1.4322.573
Line 5: '
Line 6: ' Changes to this file may cause incorrect behavior and will be lost if
Line 7: ' the code is regenerated.
Line 8: ' </autogenerated>
Line 9: '------------------------------------------------------------------------------
Line 10:
Line 11: Option Strict Off
Line 12: Option Explicit On
Line 13:
Line 14: Imports Microsoft.VisualBasic
Line 15: Imports System
Line 16: Imports System.Collections
Line 17: Imports System.Collections.Specialized
Line 18: Imports System.Configuration
Line 19: Imports System.Text
Line 20: Imports System.Text.RegularExpressions
Line 21: Imports System.Web
Line 22: Imports System.Web.Caching
Line 23: Imports System.Web.Security
Line 24: Imports System.Web.SessionState
Line 25: Imports System.Web.UI
Line 26: Imports System.Web.UI.HtmlControls
Line 27: Imports System.Web.UI.WebControls
Line 28:
Line 29: Namespace ASP
Line 30:
Line 31: Public Class test_aspx
Line 32: Inherits System.Web.UI.Page
Line 33: Implements System.Web.SessionState.IRequiresSessionState
Line 34:
Line 35: Private Shared __autoHandlers As Integer
Line 36:
Line 37: Private Shared __initialized As Boolean = false
Line 38:
Line 39: Private Shared __fileDependencies As System.Collections.ArrayList
Line 40:
Line 41:
Line 42: #ExternalSource("c:\inetpub\wwwroot\pruebas\aspnet\test.aspx",1)
Line 43:
Line 44:
Line 45: Public Class Bicicleta
Line 46: Public Modelo as String
Line 47: Public Precio as Double
Line 48: Public NumeroDeVelocidades as Integer
Line 49: Private Velocidad as Integer
Line 50:
Line 51: Public Sub Acelerar(ByVal km As Integer)
Line 52: Velocidad = Velocidad + km
Line 53: End Sub
Line 54:
Line 55: Public Sub Frenar()
Line 56: If Velocidad > 0 Then
Line 57: Velocidad = Velocidad -1
Line 58: End If
Line 59: End Sub
Line 60:
Line 61: Public Function ConsultarVelocidad() As Integer
Line 62: Return Velocidad
Line 63: End Function
Line 64: End Class
Line 65:
Line 66: Dim objBicicleta as Bicicleta = New Bicicleta
Line 67:
Line 68: Dim VelocidadActual as Integer
Line 69: objBicicleta.Modelo = "Montaña"
Line 70: objBicicleta.Precio = 200
Line 71: objBicicleta.NumeroDeVelocidades = 21
Line 72:
Line 73: objBicicleta.Acelerar(5)
Line 74: objBicicleta.Frenar()
Line 75:
Line 76: VelocidadActual = objBicicleta.ConsultarVelocidad()
Line 77:
Line 78: Response.write VelocidadActual
Line 79:
Line 80:
Line 81: #End ExternalSource
Line 82:
Line 83: Public Sub New()
Line 84: MyBase.New
Line 85: Dim dependencies As System.Collections.ArrayList
Line 86: If (ASP.test_aspx.__initialized = false) Then
Line 87: dependencies = New System.Collections.ArrayList
Line 88: dependencies.Add("c:\inetpub\wwwroot\pruebas\aspnet\test.aspx")
Line 89: ASP.test_aspx.__fileDependencies = dependencies
Line 90: ASP.test_aspx.__initialized = true
Line 91: End If
Line 92: End Sub
Line 93:
Line 94: Protected Overrides Property AutoHandlers As Integer
Line 95: Get
Line 96: Return ASP.test_aspx.__autoHandlers
Line 97: End Get
Line 98: Set
Line 99: ASP.test_aspx.__autoHandlers = value
Line 100: End Set
Line 101: End Property
Line 102:
Line 103: Protected ReadOnly Property ApplicationInstance As System.Web.HttpApplication
Line 104: Get
Line 105: Return CType(Me.Context.ApplicationInstance,System.Web.HttpApplication)
Line 106: End Get
Line 107: End Property
Line 108:
Line 109: Public Overrides ReadOnly Property TemplateSourceDirectory As String
Line 110: Get
Line 111: Return "/pruebas/aspnet"
Line 112: End Get
Line 113: End Property
Line 114:
Line 115: Private Sub __BuildControlTree(ByVal __ctrl As System.Web.UI.Control)
Line 116: End Sub
Line 117:
Line 118: Protected Overrides Sub FrameworkInitialize()
Line 119: Me.__BuildControlTree(Me)
Line 120: Me.FileDependencies = ASP.test_aspx.__fileDependencies
Line 121: Me.EnableViewStateMac = true
Line 122: Me.Request.ValidateInput
Line 123: End Sub
Line 124:
Line 125: Public Overrides Function GetTypeHashCode() As Integer
Line 126: Return 5381
Line 127: End Function
Line 128: End Class
Line 129: End Namespace
Line 130:
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:1.1.4322.573; ASP.NET Version:1.1.4322.573