I have a working MessageDisplayByValue1 which uses an inifile 'alarms.txt', the text message is displayed based on PLC value.
Since its lengthy text can not fit the label, I resorted to create another MessageDisplayByValue2
which uses the same PLC value but different inifile 'FailCodes.txt' with much shorter description( see below):
1,M25 LV -
2,M25 HV -
3,M25 LV HV - M24 LV
and some codes to print the fail label:
Dim s As String() = MessageDisplayByValue2.Text.Split("-"c)
Dim fail1 As String = s(0)
Dim fail2 As String = s(1)
ZPL_STRING = ZPL_FAIL 'copy fail label code to ZPL string
ZPL_STRING = ZPL_STRING.Replace("[FailReason1]", fail1)
ZPL_STRING = ZPL_STRING.Replace("[FailReason2]", fail2)
SendZplOverTcp(ZebraAddress)
I'd like to avoid using MessageDisplayByValue2, use only FailCodex.txt and pass the string based on PLC value of MessageDisplayByValue1.
I tried to use KeyValuePair , but have not been able to sort it out yet:
Dim lines() As String = System.IO.File.ReadAllLines(".\FailCodes.txt")
Dim list As List(Of KeyValuePair(Of Integer, String)) = New List(Of KeyValuePair(Of Integer, String)
Thanks in advance.