Problems reading an Array of Strings from CLX

Help
Mickey
2012-11-13
2013-05-30
  • Mickey
    Mickey
    2012-11-13

    I'm having issues trying to read individual strings from the array.

    Background:
        MLM_LIST(11) ->   String array in PLC

       BasicLabel1.PLCaddressText = MLM_LIST

    Ethernet driver is communicating properly as the rest of the HMI is functioning.  Also Reading a non arrayed string works well.

    When HMI is Ran I get two errors in the immediate window.
       1. First Chance Exception of type 'System.InvalidCastException' occurred in Microsoft.VisualBasic.dll ( this is present even if the plcaddresstext is empty, so I believe it's from an error somewhere else )
       2. First Chance Exception of type 'ArgumentOutofRangeException' occurred in mscorlib.dll

    If I change the PLCaddressText to MLM_LIST.Data or MLM_List.Data  The text of the label changes to a numeric value(I assume this an ascii code, but I have not verified this).  TheArumentOutofRangeException is still present.

    Update:  If only use one BasicLabel an address of MLM_List does work; however, the Range Exception error is present and if you add more labels to access different members of the array the text value never changes from the default text.

     
  • Mickey
    Mickey
    2012-11-13

    I enabled break into debugger on exception thrown for ArumentOutofRangeException.  Here is a clip board copy of the exception detail

    System.ArgumentOutOfRangeException occurred
      Message=Length cannot be less than zero.
    Parameter name: length
      ParamName=length
      Source=mscorlib
      StackTrace:
           at System.String.InternalSubStringWithChecks(Int32 startIndex, Int32 length, Boolean fAlwaysCopy)
           at System.String.Substring(Int32 startIndex, Int32 length)
           at AdvancedHMIDrivers.EthernetIPforCLXComm.PollUpdate(Timer sender, ElapsedEventArgs e) in C:\Users\xxxxx\Documents\Visual Studio 2010\Projects\AdvancedHMI\AdvancedHMIDrivers\EthernetIPforCLXComm.vb:line 518
      InnerException:

     
  • Archie
    Archie
    2012-11-16

    There is a fix to this that will be part of the next release.

     
  • Mickey
    Mickey
    2012-11-19

    Awesome.. Thanks!  I worked around it by just making MLM_List_1, MLM_List_2, etc….