在aspx.vb 里面修改:Dim YearList As New ArrayList()Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.LoadDim I As Integer
        For I = 1950 To 1990
            YearList.Add(I)
        NextEnd Sub

解决方案 »

  1.   

    还是不可以的VB页:
    Dim YearList As New ArrayList()Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            Dim I As Integer
            For I = 1950 To 1990
                YearList.Add(I)
            Next
    End Sub
    错误:
    编译错误 
    说明: 在编译向该请求提供服务所需资源的过程中出现错误。请检查下列特定错误详细信息并适当地修改源代码。 编译器错误信息: BC30390: “index.BasicInfo.YearList”是“Private”,因此它在此上下文中无法访问。
      

  2.   

    你上面所声明的YearList变量是局部变量,当然会出现错误啦。把它在你所在页类里面声明就可以了。这样页面类里面 的函数都可以访问它,错误也就解决了。
      

  3.   

    public Dim YearList As New ArrayList()
      

  4.   

    xrascal(横刀夺爱) ,现在可以用了可是,为什么循环出来的都是空值呢?下拉列表框种什么值都没有
      

  5.   

    Dim I As Integer
            For I = 1950 To 1990
                YearList.Add(I)
            Next
    现在YearList到是可以了,YearList.Add(I),我把YearList.Add("sddsf")改成也没有循环出来那应该是for没有起作用,不是这样写的吗?
      

  6.   

    Dim I As Integer
            For I = 1950 To 1990
                YearList.Add(I)
            Next
    Page.DataBind();