1
Support Questions / Re: ChartBySampling - Can it be made to....
« on: September 10, 2018, 10:10:21 AM »
Thanks Archie. That is exactly what I needed.
Steve
Steve
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
Protected Overrides Sub OnClick(e As EventArgs)
MyBase.OnClick(e)
'* Make sure an INI file was specified
If Not String.IsNullOrEmpty(m_IniFileName) Then
If String.IsNullOrEmpty(RecipeFileError) Then
' Get the file name from the button configuration
Dim file As New AdvancedHMIDrivers.IniParser(m_IniFileName)
' Get the file section from the PLC as per the button configuration
Dim section As String = m_ComComponent.Read(m_PLCAddressSaveSection, 1)(0)
' Verify the file section exists
If Not String.IsNullOrEmpty(section) Then
Dim c() As Char = {vbNullChar}
Dim TrimmedSection As String = section.Trim(c)
Dim SettingList() As String = file.ListSettings(section.Trim(c))
Settings.Clear()
For index = 0 To SettingList.Length - 1
If String.Compare(SettingList(index), "ButtonText", True) <> 0 Then
Dim s As New RecipeSaveSetting(SettingList(index), section)
Settings.Add(s)
Else
Text = file.GetSetting(TrimmedSection, SettingList(index))
End If
Next
End If
If m_ComComponent IsNot Nothing Then
For i = 0 To Settings.Count - 1
Dim v As String
Try
v = ""
v = m_ComComponent.Read(Settings(i).PLCAddress, 1)(0)
While v Is ""
End While
file.DeleteSetting(section, Settings(i).PLCAddress)
file.AddSetting(section, Settings(i).PLCAddress, v)
Catch ex As Exception
System.Windows.Forms.MessageBox.Show("Faile to write " & Settings(i).Value & " to " & Settings(i).PLCAddress & " ." & ex.Message)
End Try
Next
Else
System.Windows.Forms.MessageBox.Show("ComComponent Property must be set.")
End If
Else
System.Windows.Forms.MessageBox.Show("INI File Error - " & RecipeFileError)
End If
End If
End Sub