CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: IP information

  1. #1
    Join Date
    Mar 2009
    Posts
    5

    IP information

    Hello All,

    trying to get all the:

    IP address
    Network card description
    MAC address
    operational status
    speed

    for every network card:

    Code:
    For Each nic As System.Net.NetworkInformation.NetworkInterface In System.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces()
    
                TextBox1.Text = (String.Format("{0}", nic.Description))
                Label6.Text = (String.Format("{0}", nic.GetPhysicalAddress))
                Label10.Text = (String.Format("{0}", nic.OperationalStatus))
                Label12.Text = (String.Format("{0}", nic.Speed))
    
                
    Next
    I currently have the above, but it only returns the last network card configuration. If i put "exit for" before next, it returns the first network card result but I would like to scroll through each card?

    I know it is just putting the data in the same location, therefore overwriting the data in the labels. Could I pause the loop, and continue the loop through with a button click perhaps?

    Any help would be greatly appreciated.

    Thanks

    Paul

  2. #2
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: IP information

    You can have a multiline textbox, as well as a label.
    Code:
    Text2.text=text2.text + myvalue.text + vbCrLF
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  3. #3
    Join Date
    Jun 2005
    Location
    JHB South Africa
    Posts
    3,772

    Re: IP information

    Use a listbox and add each network to the listbox as a new item..

    Code:
                listBox1.add (String.Format("{0}", nic.Description) & String.Format("{0}", nic.GetPhysicalAddress) & String.Format("{0}", nic.OperationalStatus) & String.Format("{0}", nic.Speed))
    Gremmy..
    Articles VB6 : Break the 2G limit - Animation 1, 2 VB.NET : 2005/8 : Moving Images , Animation 1 , 2 , 3 , User Controls
    WPF Articles : 3D Animation 1 , 2 , 3
    Code snips: VB6 Hex Edit, IP Chat, Copy Prot., Crop, Zoom : .NET IP Chat (V4), Adv. ContextMenus, click Hotspot, Scroll Controls
    Find me in ASP.NET., VB6., VB.NET , Writing Articles, My Genealogy, Forum
    All VS.NET: posts refer to VS.NET 2008 (Pro) unless otherwise stated.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured