Author Topic: Add ComComponent to Basic Label dynamically  (Read 1687 times)

jwick

  • Newbie
  • *
  • Posts: 1
    • View Profile
Add ComComponent to Basic Label dynamically
« on: June 22, 2016, 05:18:35 AM »
Hello,

I have taken ModbusTCP Driver on my form and trying to assign comm component property of my basic label ,but it is throwing error as Commcomponent property not set.

below is my code [Advanced HMI V35]
Code: [Select]
BasicLabel1.CommComponent = ModbusTCPCom1
 BasicLabel1.PLCAddressValue = TextBox6.Text

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5317
    • View Profile
    • AdvancedHMI
Re: Add ComComponent to Basic Label dynamically
« Reply #1 on: June 22, 2016, 06:52:19 AM »
- In Solution Explorer, expand down the AdvancedHMIControl project
- Under AdvancedHMIControl, expand dowm the Controls folder
- Right click BasicLabel.vb and select View Code
- Modify the SubscribeToComDriver routine as show here:
Code: [Select]
    Private Sub SubscribeToComDriver()
        If Not DesignMode And IsHandleCreated Then
            '* Create a subscription handler object
            If SubScriptions Is Nothing Then
                SubScriptions = New SubscriptionHandler
                SubScriptions.Parent = Me
                AddHandler SubScriptions.DisplayError, AddressOf DisplaySubscribeError
            End If

            SubScriptions.ComComponent = m_ComComponent

            SubScriptions.SubscribeAutoProperties()
        End If
    End Sub