AdvancedHMI Software

General Category => Support Questions => Topic started by: jwick on June 22, 2016, 05:18:35 AM

Title: Add ComComponent to Basic Label dynamically
Post by: jwick 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
Title: Re: Add ComComponent to Basic Label dynamically
Post by: Archie 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