Contact Us

If you still have questions or prefer to get help directly from an agent, please submit a request.
We’ll get back to you as soon as possible.

Please fill out the contact form below and we will reply as soon as possible.

  • Contact Us
  • Home
  • Products
  • Automation Systems
  • Human Machine Interfaces (HMI)
  • NA

Obtaining your NA HMI IP address at runtime

Use VB.Net to read the HMI IP address

Written by Toby Kilroy

Updated at May 18th, 2022

Contact Us

If you still have questions or prefer to get help directly from an agent, please submit a request.
We’ll get back to you as soon as possible.

Please fill out the contact form below and we will reply as soon as possible.

  • Products
    Automation Systems Control Components Motion & Drives Quality control & Inspection Robotics Safety Sensing Services Software Switching Components
  • Amplify e-Store
    e-Store public
  • Public CSC
+ More

Introduction

Sometimes it is required to read the HMI IP address in a project. As there is no system variable which contains this information, a VB script to read the port IP addresses is used. This is a very simple VB script that uses the System.Net.DNS include. item0 to item3 are string display objects on the HMI but can be changed to suit the use case.

Link to download the example project

Sub getNAip
        exc0  = ""     exc1  = ""     exc2  = ""     exc3  = ""             Dim strHostName = System.Net.Dns.GetHostName()     Dim hostInfo = System.Net.Dns.GetHostByName(strHostName)         Try         item0 = hostInfo.AddressList(0).ToString()     Catch ex As Exception         exc0 = ex.Message         item0 = ""     End Try         Try         item1 = hostInfo.AddressList(1).ToString()     Catch ex As Exception         exc1 = ex.Message         item1 = ""     End Try             Try         item2 = hostInfo.AddressList(2).ToString()     Catch ex As Exception         exc2 = ex.Message         item2 = ""     End Try             Try         item3 = hostInfo.AddressList(3).ToString()     Catch ex As Exception         exc3 = ex.Message         item3 = ""     End Try             End Sub


ip address na hmi

Was this article helpful?

Yes
No
Give feedback about this article

Related Articles

  • How to use the ResizeHeight or ResizeWidth Animations for NA5
  • NA Screen - Switch to the Home Screen after x time of inactivity
  • How to Use Special Characters in Sysmac

Definition by Author

0
0
Expand