2005 error

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • cj

    #1

    2005 error

    The below line gives me an error on DialogResult.No saying: "Access of
    shared member, constant member, enum member or nested type through an
    instance; qualifying expression will not be evaluated." It didn't give
    me that in 2003. What does that mean?

    If MessageBox.Show ("Copy from " & fromDir & " to " & toDir & " ?", "",
    MessageBoxButto ns.YesNo, MessageBoxIcon. Question) = DialogResult.No Then
  • Parag Joshi

    #2
    Re: 2005 error

    HI CJ
    Can you post the declarations for fromDir and toDir?
    Regards
    Parag

    "cj" <cj@nospam.nosp amwrote in message
    news:uz6flnSdHH A.3648@TK2MSFTN GP05.phx.gbl...
    The below line gives me an error on DialogResult.No saying: "Access of
    shared member, constant member, enum member or nested type through an
    instance; qualifying expression will not be evaluated." It didn't give me
    that in 2003. What does that mean?
    >
    If MessageBox.Show ("Copy from " & fromDir & " to " & toDir & " ?", "",
    MessageBoxButto ns.YesNo, MessageBoxIcon. Question) = DialogResult.No Then

    Comment

    • =?Utf-8?B?S2VycnkgTW9vcm1hbg==?=

      #3
      RE: 2005 error

      cj,

      When you use DialogResult.No you are referencing the form's DialogResult
      property, which is an instance of the DialogResult class.

      Instead, use Windows.Forms.D ialogResult.No to access the shared member.

      Kerry Moorman


      "cj" wrote:
      The below line gives me an error on DialogResult.No saying: "Access of
      shared member, constant member, enum member or nested type through an
      instance; qualifying expression will not be evaluated." It didn't give
      me that in 2003. What does that mean?
      >
      If MessageBox.Show ("Copy from " & fromDir & " to " & toDir & " ?", "",
      MessageBoxButto ns.YesNo, MessageBoxIcon. Question) = DialogResult.No Then
      >

      Comment

      • ClayB

        #4
        Re: 2005 error

        Instead of typing DialogResult.No , type the fully qualified Shared
        property:

        System.Windows. Forms.DialogRes ult.No

        =============== ====
        Clay Burch
        Syncfusion, Inc.

        Comment

        • Herfried K. Wagner [MVP]

          #5
          Re: 2005 error

          "cj" <cj@nospam.nosp amschrieb:
          The below line gives me an error on DialogResult.No saying: "Access of
          shared member, constant member, enum member or nested type through an
          instance; qualifying expression will not be evaluated." It didn't give
          me that in 2003. What does that mean?
          >
          If MessageBox.Show ("Copy from " & fromDir & " to " & toDir & " ?", "",
          MessageBoxButto ns.YesNo, MessageBoxIcon. Question) = DialogResult.No Then
          There is a name clash between the form's 'DialogResult' property and the
          'DialogResult' type, and the compiler will bind to the property instead of
          the type. To solve the problem, qualify the type name:

          \\\
          If d.ShowDialog() = System.Windows. Forms.DialogRes ult.OK Then
          ...
          End If
          ///

          --
          M S Herfried K. Wagner
          M V P <URL:http://dotnet.mvps.org/>
          V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

          Comment

          • Linda Liu [MSFT]

            #6
            RE: 2005 error

            Hi Cj,

            I performed a test based on your sample code but didn't reproduce the
            problem on my side.

            The namespace "System.Windows .Forms" is imported automatically in WinForms
            application projects. In my test project, it's same whether I add the
            namespace to the expression 'DialogResult.N o' (i.e.
            System.Windows. Forms.DialogRes ult.No) or not.

            But you may have a try adding the namespace to the 'DialogResult.N o' to see
            if the problem still exists.

            If the problem still exists, you may send me a sample project that could
            just reproduce the problem. To get my actual email address, remove "online"
            from my displayed email address.


            Sincerely,
            Linda Liu
            Microsoft Online Community Support

            =============== =============== =============== =====
            Get notification to my posts through email? Please refer to
            http://msdn.microsoft.com/subscripti...ult.aspx#notif
            ications.

            Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
            where an initial response from the community or a Microsoft Support
            Engineer within 1 business day is acceptable. Please note that each follow
            up response may take approximately 2 business days as the support
            professional working with you may need further investigation to reach the
            most efficient resolution. The offering is not appropriate for situations
            that require urgent, real-time or phone-based interactions or complex
            project analysis and dump analysis issues. Issues of this nature are best
            handled working with a dedicated Microsoft Support Engineer by contacting
            Microsoft Customer Support Services (CSS) at
            http://msdn.microsoft.com/subscripti...t/default.aspx.
            =============== =============== =============== =====

            This posting is provided "AS IS" with no warranties, and confers no rights.

            Comment

            Working...