Hi,

Why is my app crashing when it executes this:
Private Sub tmr_reconnect_rs232_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tmr_reconnect_rs232.Tick

' tmr_reconnect_rs232 is set to 300ms

Counter_reconnect_rs232 = Counter_reconnect_rs232 + 1

If Counter_reconnect_rs232 >= 10 Then
Connect_Main_Port() ' if this counter isn't reset to zero by the running software
' then it will try to reconnect the RS232
End If
End Sub
Private Sub SerialPort_MAIN_DataReceived(ByVal sender As Object, ByVal e As _
System.IO.Ports.SerialDataReceivedEventArgs) Handles SerialPort_Main.DataReceived

Counter_reconnect_rs232 = 0 ' if this counter reaches 10, then it means the COMMS are broken and it will try to reconnect RS232,
..............

End Sub
This timer is always enabled, but the crash only happens when I disconnect my appliance from RS232, and even if I reconnect it back in 2 seconds, then it crashes.
If the RS link is not broken, then the app doesn't crash, it works fine.

What am I doing wrong?
Or how else can I do it?

Why do I need this? Because the RS232 link is over the Bluetooth, and if the user wanders off too far with the mobile device, then the link is broken, but when the user comes back I want the link to come back alive on its own, not ask the user to reconnect it.

Thanks.