|
-
Oct 14th, 2006, 03:22 AM
#1
[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:
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
-
Oct 14th, 2006, 03:31 AM
#2
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:
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:
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.
-
Oct 14th, 2006, 03:56 AM
#3
Re: [2005] Got a warning!
Hi jm,
Like usual the right answer and explanation.
Thanks,
sparrow1
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|