Question my.computer.network question...

ianr900

Member
Joined
Jul 13, 2006
Messages
18
Location
UK
Programming Experience
3-5
I'm using VB .NET (2003) and I can't seem to get VB to recognise the My.Computer... method. It tells me the name 'My' is not declared:

VB.NET:
Imports System.Net.Sockets
Imports System.Runtime.InteropServices
Imports System
Imports System.Net
Imports System.Net.NetworkCredential
Imports System.Text
Imports System.Windows.Forms.Form

Namespace System.Name
	Public Class Form1
		Sub MyPing()
			If My.Computer.Network.Ping("198.01.01.01") Then
				MsgBox("Server pinged successfully.")
			Else
				MsgBox("Ping request timed out.")
			End If
		End Sub
	End Class
End Namespace

Is this because my version of VB .NET doesn't support this method? Or am I doing something wrong?
\Thx
 
The My objects were new in previous version, VS 2005, I recommend you get Visual Basic 2008 Express Edition. VS 2010 will also be available soon, it's in Beta stage now.

The Ping class that your code uses was also new in .Net 2.0 by the way.
 
Back
Top