代码之家  ›  专栏  ›  技术社区  ›  Buggieboy

VB.NET中显然不存在的变量赋值

  •  1
  • Buggieboy  · 技术社区  · 16 年前

    Public Sub New()
        ParentWindow = Me
    

    哪里没有 父窗口 变量已定义,并且似乎没有在此处继承:

    Public Class MainWindow
        Inherits System.Windows.Forms.Form
    
        Private Shared parentWindow As MainWindow
        '....
    

    这是:

    DocumentCount = 0;
    

    3 回复  |  直到 16 年前
        1
  •  1
  •   SLaks    16 年前

    VB不区分大小写,所以它实际上是分配给 parentWindow documentCount .

    (根据其他评论编辑)

        2
  •  3
  •   JaredPar    16 年前

    如果这是工作,它很可能是你有 Option Explicit

    Option Explicit On
    
        3
  •  0
  •   Meta-Knight    16 年前

    VB不区分大小写。所以parentWindow和parentWindow很可能引用同一个变量。通常IDE会为您解决这个问题。。。