我是个初学者:以下怎么不能运行?
<%@page language="vb" runat="server"%>
<script runat="server">
public class car
  private _color as string
  private _gear as integer
  public property color as string
    get
      return _color
    end get
    set
      _color=value
    end set
  end property
  public readonly property gear as integer
    get 
      return _gear
    end get
  end property
  public sub changegear(direction as integer)
    if direction<0 then _gear-=1
    if direction>0 then _gear+=1
    if _gear>5 then _gear=5
    if _gear<-1 then _gear=-1
  end sub
end class
sub page_load()
  dim mycar as new car()
  response.write ("<b>New object 'mycar' created.</b>")
  response.write ("<br/>color:"&mycar.color)
  response.write ("<br/>Gear:"&mycar.gear)
  
  mycar.color="Black"
  mycar.changegear(+1)
  response.write ("<br/><b>properties updated.</b>")
  response.write ("<br/>New color:"&mycar.color)
  response.write ("<br/>New gear:"&mycar.gear)
end sub  
</script>

解决方案 »

  1.   

    <%@page language="vb" runat="server"%> ???这个里面不需要runat="server": <%@page language="vb">
      

  2.   

    不好意思, 上面错了, 少了一个%号, 应该是:<%@page language="vb"%>
      

  3.   

    错误提示:
    “/aspnet/class”应用程序中的服务器错误。
    --------------------------------------------------------------------------------编译错误 
    说明: 在编译向该请求提供服务所需资源的过程中出现错误。请检查下列特定错误详细信息并适当地修改源代码。 编译器错误信息: BC30180: 关键字没有命名类型。源错误: 行 31:     <System.Runtime.CompilerServices.CompilerGlobalScopeAttribute()>  _
    行 32:     Public Class Global_asax
    行 33:         Inherits class.Global
    行 34:         
    行 35:         Private Shared __initialized As Boolean = false
     源文件: C:\WINNT\Microsoft.NET\Framework\v1.1.4322\Temporary ASP.NET Files\aspnet_class\2a07ab25\ad43f2b4\njjcsbra.0.vb    行: 33 显示详细的编译器输出:
    C:\WINNT\system32> "c:\winnt\microsoft.net\framework\v1.1.4322\vbc.exe" /t:library /utf8output /R:"c:\winnt\assembly\gac\system.web\1.0.5000.0__b03f5f7f11d50a3a\system.web.dll" /R:"c:\winnt\assembly\gac\system\1.0.5000.0__b77a5c561934e089\system.dll" /R:"c:\winnt\assembly\gac\system.web.services\1.0.5000.0__b03f5f7f11d50a3a\system.web.services.dll" /R:"c:\winnt\assembly\gac\system.xml\1.0.5000.0__b77a5c561934e089\system.xml.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\microsoft.net\framework\v1.1.4322\temporary asp.net files\aspnet_class\2a07ab25\ad43f2b4\assembly\dl2\a2871a80\0092b660_2d9ac401\class.dll" /R:"c:\winnt\assembly\gac\system.data\1.0.5000.0__b77a5c561934e089\system.data.dll" /R:"c:\winnt\assembly\gac\system.enterpriseservices\1.0.5000.0__b03f5f7f11d50a3a\system.enterpriseservices.dll" /out:"C:\WINNT\Microsoft.NET\Framework\v1.1.4322\Temporary ASP.NET Files\aspnet_class\2a07ab25\ad43f2b4\njjcsbra.dll" /D:DEBUG=1 /debug+  "C:\WINNT\Microsoft.NET\Framework\v1.1.4322\Temporary ASP.NET Files\aspnet_class\2a07ab25\ad43f2b4\njjcsbra.0.vb"
    Microsoft (R) Visual Basic .NET 编译器版本 7.10.3052.4
    用于 Microsoft (R) .NET Framework 版本 1.1.4322.573
    版权所有 (C) Microsoft Corporation 1987-2000。保留所有权利。C:\WINNT\Microsoft.NET\Framework\v1.1.4322\Temporary ASP.NET Files\aspnet_class\2a07ab25\ad43f2b4\njjcsbra.0.vb(33) : error BC30180: 关键字没有命名类型。        Inherits class.Global
                     ~~~~~        显示完整的编译源:
    行 1:    '------------------------------------------------------------------------------
    行 2:    ' <autogenerated>
    行 3:    '     This code was generated by a tool.
    行 4:    '     Runtime Version: 1.1.4322.573
    行 5:    '
    行 6:    '     Changes to this file may cause incorrect behavior and will be lost if 
    行 7:    '     the code is regenerated.
    行 8:    ' </autogenerated>
    行 9:    '------------------------------------------------------------------------------
    行 10:   
    行 11:   Option Strict Off
    行 12:   Option Explicit On
    行 13:   
    行 14:   Imports Microsoft.VisualBasic
    行 15:   Imports System
    行 16:   Imports System.Collections
    行 17:   Imports System.Collections.Specialized
    行 18:   Imports System.Configuration
    行 19:   Imports System.Text
    行 20:   Imports System.Text.RegularExpressions
    行 21:   Imports System.Web
    行 22:   Imports System.Web.Caching
    行 23:   Imports System.Web.Security
    行 24:   Imports System.Web.SessionState
    行 25:   Imports System.Web.UI
    行 26:   Imports System.Web.UI.HtmlControls
    行 27:   Imports System.Web.UI.WebControls
    行 28:   
    行 29:   Namespace ASP
    行 30:       
    行 31:       <System.Runtime.CompilerServices.CompilerGlobalScopeAttribute()>  _
    行 32:       Public Class Global_asax
    行 33:           Inherits class.Global
    行 34:           
    行 35:           Private Shared __initialized As Boolean = false
    行 36:           
    行 37:           Public Sub New()
    行 38:               MyBase.New
    行 39:               If (ASP.Global_asax.__initialized = false) Then
    行 40:                   ASP.Global_asax.__initialized = true
    行 41:               End If
    行 42:           End Sub
    行 43:       End Class
    行 44:   End Namespace
    行 45:   
     
    --------------------------------------------------------------------------------
    版本信息: Microsoft .NET Framework 版本:1.1.4322.573; ASP.NET 版本:1.1.4322.573
      

  4.   

    行 32:     Public Class Global_asax
    行 33:         Inherits class.Global
    估计是class.Global有问题
    class可是关键字呀,你换一个吧
      

  5.   

    怎么换?class关键字用不了么?
    那怎么办?
      

  6.   

    用VS.net把代码分开写  试试..
      

  7.   

    class是你的项目名称吧?老大,这么多名你可以用,干嘛用这个呀!