AdvancedHMI Software
General Category => Support Questions => Topic started by: Darrell on February 17, 2017, 11:21:24 AM
-
I have 6 identical machines , none have HMI's , all have a drop to one Ethernet switch . I built one hmi to run on a laptop with 7 pages , All my pages have the driver IP's starting with the same IP address. On each page I have a button to force a specific IP into the PLC driver for any of the 6 machines I want to view, Is there way to change the IP on the fly from the startup page that will change it on all pages at once .
Darrell
-
Am I stuck to make a separate HMI for each to avoid confusion
-
Not sure if it will work, but you can try using application settings for the IPAddress:
- Select the driver to see the properties
- At the very top you will see (Aplication Settings). Expand that down
- Click the ellipsis button in the Property Bindings to get an Application Setting dialog window
- For IPAddress, click the drop down and select New
- Enter a name, such as DriversIPAddress
- Accept those windows
- Go to the other driver instances and repeat the process, except do not create a new, but use the same setting you created for the first
Now in your button click code, enter this:
My.Settings.DriversIPAddress="192.1.1.1."
This should in theory change all of the drivers IPAddresses at the same time.
-
thanks, appears to work off line ,will try it live in the next few days and post the results
-
Hi Darrell, did you try to change the ip for comm as Archie told? I tried but it didnt work.
-
For some reason when I tried it off line it seem to work , but I tried again today and could not get this to work
-
Ok now it works but not as i want. I have my button to change IPAddress on main form and one more form with parameters which i wanna change IPAddress. Now if i start debuging and click button for change IPAddress, the IP changed, but if you first go to second form and then back to main and click button, the IP wont change. As soon as second form is open, ip change button dont work anymore.
Now if u have more IPs to change u need to stop debuging and start it again to change IP. Its possible to close the form with "back" button completely? I think thats the problem, because already open form is running in the back.
And one more question for Archie. How its about data, only open form get data, or all forms getting data although you havent seen them. A asking this because of a cellular 3g data usage.
It works correctly with multiple ip change if you open .exe file and add Me.Close() to my back button for close form.
-
And one more question for Archie. How its about data, only open form get data, or all forms getting data although you havent seen them. A asking this because of a cellular 3g data usage.
This depends whether you have copied the default code snippet from the MainForm to the additional forms you have added:
'*******************************************************************************
'* Stop polling when the form is not visible in order to reduce communications
'* Copy this section of code to every new form created
'*******************************************************************************
Private NotFirstShow As Boolean
Private Sub Form_VisibleChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.VisibleChanged
'* Do not start comms on first show in case it was set to disable in design mode
If NotFirstShow Then
AdvancedHMIDrivers.Utilities.StopComsOnHidden(components, Me)
Else
NotFirstShow = True
End If
End Sub
-
Try this modification:
- In Solution Explorer, expand down the AdvancedHMIDrivers project
- Expand down the \Modbus folder
- Right click ModbusTCPCom.vb and select view code
- Go to line 47 and insert this line of code:
Implements System.Windows.Forms.IBindableComponent
- Now Go to line 158 and look for #End Region
- Just below that line of code, add the following code:
#Region "Binding Properties"
Private m_bindingContext As System.Windows.Forms.BindingContext
Private m_dataBindings As System.Windows.Forms.ControlBindingsCollection
<System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Content)>
Public ReadOnly Property DataBindings As System.Windows.Forms.ControlBindingsCollection Implements System.Windows.Forms.IBindableComponent.DataBindings
Get
If (m_dataBindings Is Nothing) Then
m_dataBindings = New System.Windows.Forms.ControlBindingsCollection(Me)
End If
Return m_dataBindings
End Get
End Property
<System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Content)>
Public Property BindingContext As System.Windows.Forms.BindingContext Implements System.Windows.Forms.IBindableComponent.BindingContext
Get
If m_bindingContext Is Nothing Then
m_bindingContext = New System.Windows.Forms.BindingContext()
End If
Return m_bindingContext
End Get
Set(value As System.Windows.Forms.BindingContext)
m_bindingContext = value
' Throw New NotImplementedException()
End Set
End Property
#End Region
- Build the solution
It will now be necessary to remove the driver instances from your forms and add again so Visual Studio can insert the appropriate code on its side. After that, you should be able to follow the procedure in the above post and get the desired effect.