Results 1 to 3 of 3

Thread: [RESOLVED] [2005] Got a warning!

  1. #1

    Thread Starter
    PowerPoster sparrow1's Avatar
    Join Date
    May 2005
    Location
    Globetrotter
    Posts
    2,820

    Resolved [RESOLVED] [2005] Got a warning!

    Hi All,

    A little more explanation about the title.
    I'm trying to set the Formborderstyle of my Form to FixedSingle and I'm using the code below;

    VB Code:
    1. Me.FormBorderStyle = FormBorderStyle.FixedSingle

    It's working but It gave me this warning:

    Access of shared member, constant member, enum member or nested type through an instance; qualifying expression will not be evaluated

    What can I do about it.

    Thanks in advance,

    sparrow1
    Wkr,
    sparrow1

    If I helped you, don't forget to Rate my post. Thank you

    I'm using Visual Studio.Net 2003 and
    2005
    How to learn VB.Net Create setup with VB 2005 Drawing for beginners VB.Net Tutorials GDI+ Tutorials
    Video's for beginners

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,222

    Re: [2005] Got a warning!

    When you refer to "FormBorderStyle" on the right of that assignment it is being interpreted as the FormBorderStyle property of the form, i.e.
    VB Code:
    1. Me.FormBorderStyle = Me.FormBorderStyle.FixedSingle
    It is incorrect to refer to an enumerated value via a variable or property of that type. In order to specify the FormBorderStyle type you need to qualify the name with it's namespace, i.e.
    VB Code:
    1. Me.FormBorderStyle = Windows.Forms.FormBorderStyle.FixedSingle
    This is the very same reason that whaen you test the return value of a MessageBox.Show call you must specify Windows.Forms.DialogResult rather than just DialogResult, which is interpreted as the DialogResult property of the form.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    PowerPoster sparrow1's Avatar
    Join Date
    May 2005
    Location
    Globetrotter
    Posts
    2,820

    Re: [2005] Got a warning!

    Hi jm,

    Like usual the right answer and explanation.

    Thanks,

    sparrow1
    Wkr,
    sparrow1

    If I helped you, don't forget to Rate my post. Thank you

    I'm using Visual Studio.Net 2003 and
    2005
    How to learn VB.Net Create setup with VB 2005 Drawing for beginners VB.Net Tutorials GDI+ Tutorials
    Video's for beginners

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width