Using 2 timer controls on one single form
Posted on 2009-07-10
I have a windows form in vb.net 2008. This form has one timer control. This Pc is connected to 2 hardware units. My form reads the data from these 2 hardware units via the serial port. I have set the timer interval to 5 seconds. So after the first 5 seconds, I send request to serial port "1" which means data for hardware unit 1 and then I read receiving data for hardware unit 1 and then after next 5 seconds, I send request to serial port as "2" which means data for hardware unit 2 and I read the receiving data for hardware unit 2 and again after 5 seconds for hardware unit 1 and so on.
Now the client has suggested changes. He wants that I send request for hadware unit 1 after 5 seconds and the request for hardware unit 2 after 30 seconds. But I found that to implement this, I need to keep changing the timer interval after reading the data from serial port and this hangs the PC.
Hence now my question is:
1. Can I use two timer controls on one form with two different timer intervals?
2. If the above is not possible, then can I use two forms with two timer controls - one on each form with different timer internvals? The issue here would be that once I open the serial port in form 1, it may not allow me to open the port in form 2 as the serial port would be in use in form 1.