What's new
Visual Studio.Net Help Community

A community to get Microsoft Visual Studio.Net programming help.

Visual Studio.Net Help Community is a community for .Net programmers to interact with people who want to learn to program using the Microsoft Visual Studio.Net languages or who program using the Microsoft .Net languages and want to share their .Net knowledge.

Visual Studio.Net Help Community is a free programmer help site so why not join the community today? Once you are a member you get access to all our .Net programming discussions.

Test VB.Net

EDN Admin

Staff member
Joined
Aug 7, 2010
Location
In the Machine
#1
Visual Basic:
Public Shared Function GetMac(ByVal ipAddr As String) As String

Dim macAddress As String = String.Empty
Try
Dim destIP As Net.IPAddress = Net.IPAddress.Parse(ipAddr)
Dim IP() As Byte = destIP.GetAddressBytes()
Dim IPInt As Int32 = BitConverter.ToInt32(IP, 0)
Dim mac() As Byte = New Byte(5) {}
SendARP(IPInt, 0, mac, mac.Length)
macAddress = BitConverter.ToString(mac, 0, mac.Length)
Catch ex As Exception
Debug.Write(ex.Message)
End Try
Return macAddress

End Function

Private Sub button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button1.Click

Me.MACAddressDisplayLabel.Text = GetMac(Me.MacLocalIPAddressBox.Text)
End Sub
 
Last edited by a moderator:

EDN Admin

Staff member
Joined
Aug 7, 2010
Location
In the Machine
#2
C#:
protected void SendEMail(string MailTo, string MailFrom, string MailSubject, string MailBody)
{
MailMessage objEmail = new MailMessage();
objEmail.To = MailTo;
objEmail.From = MailFrom;
objEmail.Subject = MailSubject;
MailBody = MailBody.Replace("rn", "<br>");
MailBody = MailBody.Replace("t", "     ");
objEmail.Body = MailBody;
objEmail.Priority = MailPriority.High;
objEmail.BodyFormat = MailFormat.Html;

try
{
SmtpMail.Send(objEmail);
}
catch (Exception exc)
{
Response.Write("Send failure: " + exc.ToString());
}           
}
 
Last edited:

AWS

Staff member
Joined
May 18, 1998
Location
Florida U.S.A.
#8
VB.Net:
Public Shared Function GetMac(ByVal ipAddr As String) As String

Dim macAddress As String = String.Empty
Try
Dim destIP As Net.IPAddress = Net.IPAddress.Parse(ipAddr)
Dim IP() As Byte = destIP.GetAddressBytes()
Dim IPInt As Int32 = BitConverter.ToInt32(IP, 0)
Dim mac() As Byte = New Byte(5) {}
SendARP(IPInt, 0, mac, mac.Length)
macAddress = BitConverter.ToString(mac, 0, mac.Length)
Catch ex As Exception
Debug.Write(ex.Message)
End Try
Return macAddress

End Function

Private Sub button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button1.Click

Me.MACAddressDisplayLabel.Text = GetMac(Me.MacLocalIPAddressBox.Text)
End Sub
 
Last edited:

Top Bottom