Can't clear Warnings

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I guess my thing is that if you let the warnings sit then what's the point of
having them, so I like to clear them and I have a couple that I can't seem to.

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

Here's the code:

MyContextMenu.Show(MyListView,
MyListView.PointToClient(MyListView.MousePosition()))

I get the warning on MyListView.MousePosition(). MousePosition is a Point,
and a Point is what the param of PointToClient is looking for.

2) Late bound resolution; runtime errors could occur.

Dim i As Int32 = CType(MyListBox.SelectedItem.ID, Int32)

I get the warning on MyListBox.SelectedItem.ID even though I am explicity
casting it.

How do I clear these? (BTW, I know I can just turn it off, but there must
be a way to resolve these, musn't there?)

Ed
 
MyListView.MousePosition uses an object instance (MyListView) to refer to a
shared member (MousePosition). It suffices to use syntax like
Control.MousePosition. VB.NET used to be forgiving about this, the latest
version treats it as a warning.
 
Back
Top