I finally got to work with the message box code and writing to PLC addresses and it works great. Here is the code I used. I know I still have to change my MsgBox To MessageBox show but I originally had some issues with the use of message box.
[/Private Sub DataSubscriber21_DataChanged(sender As Object, e As Drivers.Common.PlcComEventArgs) Handles DataSubscriber21.DataChanged
If e.PlcAddress = "002575" Then
If e.Values(0) = True Then
TextBox4.Text = "! Open Manual Valve From HXTo The MLT !"
TextBox4.BackColor = Color.Red
End If
If e.Values(0) = "True" Then
MsgBox("Open Manual Valve From HX To MLT", MsgBoxStyle.Exclamation + MsgBoxStyle.OkOnly)
End If
End If
If e.PlcAddress = "003585" Then
If e.Values(0) = True Then
TextBox4.Text = "! Dough-In Complete !"
TextBox4.BackColor = Color.Red
End If
If e.Values(0) = "True" Then
MsgBox("Dough-In Complete, Reset Dough-In Alarm", MsgBoxStyle.Exclamation + MsgBoxStyle.OkOnly)
End If
If MsgBoxResult.Ok Then
Me.ModbusRTUCom1.Write("047522", "1")
End If
End If
If e.PlcAddress = "003586" Then
If e.Values(0) = True Then
TextBox4.Text = "! Acid Rest Complete !"
TextBox4.BackColor = Color.Red
End If
If e.Values(0) = "True" Then
MsgBox("Acid Rest Complete, Reset Acid Rest Alarm", MsgBoxStyle.Exclamation + MsgBoxStyle.OkOnly)
End If
If MsgBoxResult.Ok Then
Me.ModbusRTUCom1.Write("047524", "1")
End If
End If
If e.PlcAddress = "003587" Then
If e.Values(0) = True Then
TextBox4.Text = "! Protein Rest Complete !"
TextBox4.BackColor = Color.Red
End If
If e.Values(0) = "True" Then
MsgBox("Protein Rest Complete, Reset Protein Rest Alarm", MsgBoxStyle.Exclamation + MsgBoxStyle.OkOnly)
End If
If MsgBoxResult.Ok Then
Me.ModbusRTUCom1.Write("047526", "1")
End If
End If
If e.PlcAddress = "003588" Then
If e.Values(0) = True Then
TextBox4.Text = "! Beta Rest Complete !"
TextBox4.BackColor = Color.Red
End If
If e.Values(0) = "True" Then
MsgBox("Beta Rest Complete, Reset Beta Rest Alarm", MsgBoxStyle.Exclamation + MsgBoxStyle.OkOnly)
End If
If MsgBoxResult.Ok Then
Me.ModbusRTUCom1.Write("047528", "1")
End If
End If
Dim CC As DialogResult
If e.PlcAddress = "003589" Then
If e.Values(0) = True Then
TextBox4.Text = "! Perform Iodine Test !"
TextBox4.BackColor = Color.Red
End If
If e.Values(0) = "True" Then
CC = System.Windows.Forms.MessageBox.Show("Perform Iodine Test On The Mash Is Conversion Complete?", "Conversion Complete?", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
If CC = Windows.Forms.DialogResult.Yes Then
MsgBox("Saccharification Rest Complete, Reset Saccharification Rest Alarm", MsgBoxStyle.Exclamation + MsgBoxStyle.OkOnly)
If MsgBoxResult.Ok Then
Me.ModbusRTUCom1.Write("047530", "1")
End If
End If
If CC = Windows.Forms.DialogResult.No Then
MsgBox("Add 10 Minutes to Saccharification Rest Timer", MsgBoxStyle.Exclamation + MsgBoxStyle.OkOnly)
If MsgBoxResult.Ok Then
Me.ModbusRTUCom1.Write("047529", "0")
Me.ModbusRTUCom1.Write("045747", "1")
Me.ModbusRTUCom1.Write("003589", "0")
Me.ModbusRTUCom1.Write("047530", "0")
End If
End If
End If
End If
If e.PlcAddress = "003590" Then
If e.Values(0) = True Then
TextBox4.Text = "! Mash-Out Complete !"
TextBox4.BackColor = Color.Red
End If
If e.Values(0) = "True" Then
MsgBox("Mash-Out Complete, Reset Mash-Out Alarm", MsgBoxStyle.Exclamation + MsgBoxStyle.OkOnly)
End If
If MsgBoxResult.Ok Then
Me.ModbusRTUCom1.Write("047532", "1")
Timer1.Stop()
End If
End If
End Subcode]
Thanks for the help.