Author Topic: how to add property to the usercontrol  (Read 580 times)

oqapsking

  • Full Member
  • ***
  • Posts: 178
    • View Profile
how to add property to the usercontrol
« on: May 02, 2017, 02:25:41 PM »
hello

i made a new user control

i used in it

picturebox1
basiclabel1
label1

how can i add to it ahmi property ??

i mean i need to add property to change plc address for the basiclabel1 in it
and to chose the comcomponent
and the label1 text

in any form am using it in

with thanks

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5269
    • View Profile
    • AdvancedHMI
Re: how to add property to the usercontrol
« Reply #1 on: May 02, 2017, 08:54:38 PM »
It can require quite a bit of code to expose the properties of controls in a User Control to the VS environment. This would be an example of exposing the ComComponent of your 2 items:
Code: [Select]
Public Property ComComponent as MfgControl.AdvancedHMI.Drivers.IComComponent
Get
   Return BasicLabel1.ComComponent
End Get
Set (value as MfgControl.AdvancedHMI.Drivers.IComComponent)
    BasicLabel1.ComComponent=value
    PictureBox1.ComCompoent=value
End Set

You will have to add similar code for every property you want to expose.

oqapsking

  • Full Member
  • ***
  • Posts: 178
    • View Profile
Re: how to add property to the usercontrol
« Reply #2 on: May 03, 2017, 02:43:58 PM »
that was very helpful
i didn`t test the com yet but i understood what i need to do

thanks alot