Click here to Skip to main content
16,005,339 members
Home / Discussions / Visual Basic
   

Visual Basic

 
QuestionMAC address retrieval Pin
abhinish24-Nov-05 18:54
abhinish24-Nov-05 18:54 
AnswerRe: MAC address retrieval Pin
Briga24-Nov-05 22:15
Briga24-Nov-05 22:15 
AnswerRe: MAC address retrieval Pin
Dave Kreskowiak25-Nov-05 6:36
mveDave Kreskowiak25-Nov-05 6:36 
GeneralRe: MAC address retrieval Pin
abhinish25-Nov-05 18:32
abhinish25-Nov-05 18:32 
GeneralRe: MAC address retrieval Pin
Dave Kreskowiak27-Nov-05 15:24
mveDave Kreskowiak27-Nov-05 15:24 
GeneralRe: MAC address retrieval Pin
abhinish28-Nov-05 18:49
abhinish28-Nov-05 18:49 
AnswerRe: MAC address retrieval Pin
GregRH16-Dec-05 13:01
GregRH16-Dec-05 13:01 
GeneralRe: MAC address retrieval Pin
abhinish16-Dec-05 18:06
abhinish16-Dec-05 18:06 
Ya it is working fine with some modifications thanks to dave .

what i m doing is taking the IP address in a text box from the user than showing the MAC address in another textbox

do like this :
form level declaration:
<br />
imports system.net<br />
<br />
 <DllImport("iphlpapi.dll")> _<br />
    Private Shared Function SendARP(ByVal DestIP As UInteger, ByVal SrcIP As UInteger, <Out()> ByVal pMacAddr() As Byte, ByRef PhyAddrLen As Integer) As UInteger<br />
    End Function


than in any button event use this:


 Private Sub Button13_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button13.Click<br />
<br />
        Try<br />
            Dim addr As IPAddress = IPAddress.Parse(TextBox5.Text)<br />
            Dim mac(6) As Byte<br />
            Dim len As Integer = mac.Length<br />
            SendARP(CType(addr.Address, UInteger), 0, mac, len)<br />
<br />
            Dim macAddress As String = BitConverter.ToString(mac, 0, len)<br />
            If macAddress = "" Then<br />
                MsgBox("Cannot Resolve MAC from The Given IP Address")<br />
                Return<br />
            End If<br />
            TextBox6.Text = macAddress<br />
<br />
        Catch ex As System.FormatException<br />
            MsgBox("Enter an Valid IP Address..." + ex, MsgBoxStyle.Critical)<br />
        Catch ex As System.ArithmeticException<br />
            MsgBox("Cannot extract MAC address " + ex, MsgBoxStyle.Critical)<br />
<br />
        End Try<br />
<br />
    End Sub


try it and tell me if u have any problem

abhinav
QuestionHand Cursor in .NET Pin
marclile24-Nov-05 17:26
marclile24-Nov-05 17:26 
AnswerRe: Hand Cursor in .NET Pin
Christian Graus24-Nov-05 17:53
protectorChristian Graus24-Nov-05 17:53 
AnswerRe: Hand Cursor in .NET Pin
progload25-Nov-05 14:11
progload25-Nov-05 14:11 
Questionregister accessing from VB6 Pin
vani_bel24-Nov-05 17:01
vani_bel24-Nov-05 17:01 
AnswerRe: register accessing from VB6 Pin
Dave Kreskowiak25-Nov-05 4:16
mveDave Kreskowiak25-Nov-05 4:16 
QuestionForce Panel to scroll Pin
spelltwister24-Nov-05 15:44
spelltwister24-Nov-05 15:44 
QuestionCoding web camera Pin
Amr M. K.24-Nov-05 6:43
Amr M. K.24-Nov-05 6:43 
AnswerRe: Coding web camera Pin
Briga24-Nov-05 7:17
Briga24-Nov-05 7:17 
QuestionEnforcing Referrential Integrity in VB.NET Pin
R. A. Abbasi24-Nov-05 4:56
R. A. Abbasi24-Nov-05 4:56 
AnswerRe: Enforcing Referrential Integrity in VB.NET Pin
Steve Pullan24-Nov-05 18:31
Steve Pullan24-Nov-05 18:31 
GeneralRe: Enforcing Referrential Integrity in VB.NET Pin
R. A. Abbasi24-Nov-05 18:37
R. A. Abbasi24-Nov-05 18:37 
GeneralRe: Enforcing Referrential Integrity in VB.NET Pin
Steve Pullan24-Nov-05 18:51
Steve Pullan24-Nov-05 18:51 
GeneralRe: Enforcing Referrential Integrity in VB.NET Pin
R. A. Abbasi24-Nov-05 20:58
R. A. Abbasi24-Nov-05 20:58 
GeneralRe: Enforcing Referrential Integrity in VB.NET Pin
Steve Pullan24-Nov-05 23:39
Steve Pullan24-Nov-05 23:39 
QuestionMapping drives in vb.net Pin
kongo1024-Nov-05 3:15
kongo1024-Nov-05 3:15 
AnswerRe: Mapping drives in vb.net Pin
Steve Pullan24-Nov-05 15:01
Steve Pullan24-Nov-05 15:01 
GeneralRe: Mapping drives in vb.net Pin
kongo1025-Nov-05 7:01
kongo1025-Nov-05 7:01 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.