Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.
Photo

Read Mac Address in vb

physical Address Mac Address

  • Please log in to reply
No replies to this topic

#1 David Weaver

David Weaver

    Advanced Member

  • Members
  • PipPipPip
  • 50 posts
  • LocationBloomington IL

Posted 04 September 2013 - 04:49 PM

I was not able to find any vb code on the net to read the physical address "Mac address" so I wrote the following code I hope this saves someone time in getting the Mac address.

 

Imports Microsoft.SPOT.Net.NetworkInformation

 

 '***** Get Mac Address*********************************
 
        Dim b() As Byte = Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces(0).PhysicalAddress
 
        Dim ma As String = String.Empty
 
        For i As Integer = 0 To b.Length - 1
 
            ma = ma & b(i).ToString("X2")
 
            If i <> b.Length - 1 Then
                ma = ma & "-"
            End If
        Next
 
        Debug.Print("My Mac address is :" & ma)
 





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.