Author Topic: INI file for basic labels  (Read 2132 times)

Allan19111911

  • Newbie
  • *
  • Posts: 17
    • View Profile
INI file for basic labels
« on: July 10, 2020, 09:59:40 AM »
Hello all,  I am working on an application that will have many screens, each will have it's own advanced hmi application.  They are all the same but will have basic labels pointing to different address's and will have different IP's(CLX) .   I searched the forum and found how to use the INI to assign the IP address's but can the same be done with basic labels?

Thanks
Allan

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5266
    • View Profile
    • AdvancedHMI
Re: INI file for basic labels
« Reply #1 on: July 10, 2020, 07:48:58 PM »
The INI file capability is encapsulated into a code region than can be easily copied to any control to make that control capable of being setup through an INI file.

1) In Solution Explorer, expand down AdvancedHMIControls project
2) Expand down the \Controls folder
3) Right click BarMeter.vb and select Open
4) Scroll down to the bottom looking for this:
#Region "IniFileHandling"

5) Select all code between #Region "IniFileHandling"  and # End Region , then Ctrl-C to copy

6) In Solution Explorer, right click BasicLabel.vb and select Open
7) Scroll all the way to the bottom and put the cursor to the left of End Class
8 ) Ctrl-V to paste the code
9) Scroll to the top and look for:
   Inherits System.Windows.Forms.Label
10) Add this one line of code below that:
    Implements System.ComponentModel.ISupportInitialize
11) Window->Close All Documents

You can now Rebuild the Solution and when you open your form, you will have properties for the INI File

You can use the INI files to set any property that uses an atomic value (e.g. integer, string )
« Last Edit: July 15, 2020, 01:37:25 PM by Archie »

Allan19111911

  • Newbie
  • *
  • Posts: 17
    • View Profile
Re: INI file for basic labels
« Reply #2 on: July 15, 2020, 01:17:07 PM »
just to follow up,this worked perfectly,  it took a quick forum search to learn about the ini file and sections but it was very easy.  This will make life so easy now
Thanks

Gary Foster

  • Newbie
  • *
  • Posts: 7
    • View Profile
Re: INI file for basic labels
« Reply #3 on: September 02, 2021, 03:15:03 PM »
I would like to0 implement t INI file use in the basic label.
Using AdvancedHMIv399yBeta38
Followed the instructions in this topic and got several build errors: (below)
Fhis topic is over a year old. I assume versionitis?
Is there a way to use AMHI latest version and use Ini files with the basic label?
Thanks for any assistance.

Severity   Code   Description   Project   File   Line   Suppression State
Error   BC30269   'Public Sub BeginInit()' has multiple definitions with identical signatures.   AdvancedHMIControls   C:\AHMI_Test\AdvancedHMIControls\Controls\BasicLabel.vb   947   Active
Error   BC30269   'Public Sub EndInit()' has multiple definitions with identical signatures.   AdvancedHMIControls   C:\AHMI_Test\AdvancedHMIControls\Controls\BasicLabel.vb   951   Active
Error   BC30583   'ISupportInitialize.BeginInit' cannot be implemented more than once.   AdvancedHMIControls   C:\AHMI_Test\AdvancedHMIControls\Controls\BasicLabel.vb   979   Active
Error   BC30583   'ISupportInitialize.EndInit' cannot be implemented more than once.   AdvancedHMIControls   C:\AHMI_Test\AdvancedHMIControls\Controls\BasicLabel.vb   983   Active
Error   BC2017   could not find library 'C:\AHMI_Test\AdvancedHMIControls\bin\Debug\AdvancedHMIControls.dll'   AdvancedHMI   C:\AHMI_Test\AdvancedHMI\vbc   1   Active
Error   CS0006   Metadata file 'C:\AHMI_Test\AdvancedHMIControls\bin\Debug\AdvancedHMIControls.dll' could not be found   AdvancedHMIcs   C:\AHMI_Test\AdvancedHMICS\CSC   1   Active


Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5266
    • View Profile
    • AdvancedHMI
Re: INI file for basic labels
« Reply #4 on: September 02, 2021, 04:40:47 PM »
The BasicLable already has the INI file handling code. You only need to set the properties

IniFileName

IniFileSection

Gary Foster

  • Newbie
  • *
  • Posts: 7
    • View Profile
Re: INI file for basic labels
« Reply #5 on: September 02, 2021, 07:30:23 PM »
thanks for the quick reponse.
Color me stoopid.
I don't see those properties in the property tree.
can you give me a clue where to find my problem..

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5266
    • View Profile
    • AdvancedHMI
Re: INI file for basic labels
« Reply #6 on: September 02, 2021, 07:49:59 PM »
thanks for the quick reponse.
Color me stoopid.
I don't see those properties in the property tree.
can you give me a clue where to find my problem..
My mistake. I was looking at the future beta version, not the current.

In the BasicLabel.vb , you will also need to add this line of code just below Inherits System.Windows.Forms.Label

    Implements System.ComponentModel.ISupportInitialize

By your error messages, it looks like you make have added the code twice.

Gary Foster

  • Newbie
  • *
  • Posts: 7
    • View Profile
Re: INI file for basic labels
« Reply #7 on: September 03, 2021, 02:06:00 PM »
Eggcellent, sir!!
Working as intended.
Thank you for the very prompt assistance.