hi guys, i currently using c# interface as a medium to communicate between excel file and PLC. what i trying to do is when i connect to my PLC with interface, my code will read the PLC status and show the output(ON/OFF) in datagridview. whenever i change the PLC value, output inside datagridview will change too. i was successfully try in one value. but, the problem is let say if i got 100 different value need to read from PLC and show the output to datagridview , what should i do ?
this is coding for one value only
private void timer1_Tick(object sender, EventArgs e)
{
try
{
if (adsClient.ReadAny(GVariable.out1, typeof(Boolean)).ToString() == "True")
{
dataGridView1.Rows[0].Cells[2].Value ="ON";
dataGridView1.Rows[0].Cells[2].Style.ForeColor = Color.Green;
}
else
{
dataGridView1.Rows[0].Cells[2].Value = "OFF";
dataGridView1.Rows[0].Cells[2].Style.ForeColor = Color.Red;
}
}
catch (Exception err)
{
MessageBox.Show(err.Message);
}
}GVariable.out1 is the value read from my PLC.
second, is it possible to link my status with my excel data so that when i update my excel file , my status will change too.
i have tried my best to think what method to do but still no idea, someone please help..thank alot !!