This error is exceptionally annoying. I've done various searches, and have been able to fix this issue. I am one of several developers on the application and the only one with the issue. I've fixed it before temporarily by adding an extension to the My Extensions panel in the project's properties (which generates a different error) and then removing that new extension. That made the error go away. Flaky, eh?
Anyway:
If Not My.Computer.Network.IsAvailable Then
ISConnectedToNetwork = False
...
End If
Gives the error:
'Computer' is not a member of 'My'.
Clarification Edit: This is in .NET 2.0.
The "My" namespace exposes properties in the Microsoft.VisualBasic.Devices Namespace If you have a Class Library project then My.computer
and My.Network
etc are not available because Visual Studio didn't instantiate them for you. A simple work-around is to instantiate them yourself.
Dim MyNetwork = New Microsoft.VisualBasic.Devices.Network
Debug.Print(MyNetwork.Ping("MyServerName"))
Dim MyComputer = New Microsoft.VisualBasic.Devices.Computer
Debug.Print(MyComputer.Name)
If Not MyComputer.Network.IsAvailable Then
ISConnectedToNetwork = False
End If
Etc...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With