I apologize in advance for asking so many questions, but as i said I'm new at VB programing.
Heres the deal: in the image I attached to this there are 40 comboboxes and 40 text boxes and each line represents a step so there for instance line 1 has a label step one then a combobox then a text box, so 40 lines, in each text box there will be 13 items (heat, soak, ramp, .. etc.) dependend on what step it is and on what item was selected it is going to send a value 1-13 (heat= 1, soak = 2, ramp = 3, etc.) to an N file N20[0] through N20[39] (step 1 = n20[0], step 2= n20[1], etc.).
And on top of that the value of the text box will be sent to a F file corresponding to it's step so (step 1 textbox.text = F21[0], and so on..)
Once the operator has entered in all of these items and values they will click the send to PLC button. Now I wrote a piece of code to test it and it worked with an If statement.
That code is only for the first step and there are 40 and doing this with an if statement just seems like the wrong way of doing it to me because its going to be so long and messy. So I was wondering if you could put me on the right track of writing this code if you know of a better way?
Thanks.
Private Sub btnPLC_Click(sender As System.Object, e As System.EventArgs) Handles btnPLC.Click
If OpCodeBox1.Text = "HEAT" Then
EthernetIPforCLXCom1.Write("F21[0]", OpText1.Text)
EthernetIPforCLXCom1.Write("N20[0]", 1)
ElseIf OpCodeBox1.Text = "CARBON" Then
EthernetIPforCLXCom1.Write("F21[0]", OpText1.Text)
EthernetIPforCLXCom1.Write("N20[0]", 2)
ElseIf OpCodeBox1.Text = "NULL OPCODE" Then
EthernetIPforCLXCom1.Write("F21[0]", 0)
EthernetIPforCLXCom1.Write("N20[0]", 0)
ElseIf OpCodeBox1.Text = "RAMP" Then
EthernetIPforCLXCom1.Write("F21[0]", OpText1.Text)
EthernetIPforCLXCom1.Write("N20[0]", 3)
ElseIf OpCodeBox1.Text = "SOAK" Then
EthernetIPforCLXCom1.Write("F21[0]", OpText1.Text)
EthernetIPforCLXCom1.Write("N20[0]", 4)
ElseIf OpCodeBox1.Text = "TEMP LIMIT TIME" Then
EthernetIPforCLXCom1.Write("F21[0]", OpText1.Text)
EthernetIPforCLXCom1.Write("N20[0]", 5)
ElseIf OpCodeBox1.Text = "CARBON LIMIT TIME" Then
EthernetIPforCLXCom1.Write("F21[0]", OpText1.Text)
EthernetIPforCLXCom1.Write("N20[0]", 6)
ElseIf OpCodeBox1.Text = "AMMONIA EVEN" Then
EthernetIPforCLXCom1.Write("F21[0]", OpText1.Text)
EthernetIPforCLXCom1.Write("N20[0]", 7)
ElseIf OpCodeBox1.Text = "END OF CYCLE EVENT" Then
EthernetIPforCLXCom1.Write("F21[0]", OpText1.Text)
EthernetIPforCLXCom1.Write("N20[0]",

ElseIf OpCodeBox1.Text = "SPARE EVENT" Then
EthernetIPforCLXCom1.Write("F21[0]", OpText1.Text)
EthernetIPforCLXCom1.Write("N20[0]", 9)
ElseIf OpCodeBox1.Text = "PROBE BURNOFF EVEN" Then
EthernetIPforCLXCom1.Write("F21[0]", OpText1.Text)
EthernetIPforCLXCom1.Write("N20[0]", 10)
ElseIf OpCodeBox1.Text = "TEMP DEVIATION" Then
EthernetIPforCLXCom1.Write("F21[0]", OpText1.Text)
EthernetIPforCLXCom1.Write("N20[0]", 11)
ElseIf OpCodeBox1.Text = "CARBON DEVIATION" Then
EthernetIPforCLXCom1.Write("F21[0]", OpText1.Text)
EthernetIPforCLXCom1.Write("N20[0]", 12)
End If
End Sub