컴퓨터 이름 ,맥주소 가져오기

VNote 2017.10.16 11:33:10 *: Imports System.Net.NetworkInformation
Public Class Form1

Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
Dim myComName As String = Environment.MachineName
Dim myMac As String = getMacAddress()
Label1.Text = myMac & "_" & myComName
End Sub

Function getMacAddress()
Dim nics() As NetworkInterface = _
NetworkInterface.GetAllNetworkInterfaces
Return nics(0).GetPhysicalAddress.ToString
End Function
End Class

Imports System.Net.NetworkInformation
Public Class Form1

    Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
        Dim myComName As String = Environment.MachineName
        Dim myMac As String = getMacAddress()
        Label1.Text = myMac & "_" & myComName
    End Sub

    Function getMacAddress()
        Dim nics() As NetworkInterface = _
              NetworkInterface.GetAllNetworkInterfaces
        Return nics(0).GetPhysicalAddress.ToString
    End Function
End Class