Q: C# Windows Forms Serial Communication with GMap app crash I've written desktop application, that receives location via serial communication from NRF/GPS module, split that data in order to distinguish latitude, longitude and then i load these coordinates to map(i use GMap). But when i receive data, first 1 or 2 seconds it comes in a little confused form(like this 06840.370056;49.84006068). And i thought adding some Thread.Sleep will solve this problem, but instead application crashes after 5-10 seconds. How can i solve this problem, because i want my app run smoothly? Here is part of my code:
 public partial class Form1 : Form
{

    public string dataIn;
    private List<PointLatLng> _points;

    public Form1()
    {
        _points = new List<PointLatLng>();
        InitializeComponent();
    }

    private void Form1_Load(object sender, EventArgs e)
    {
        GMapProviders.GoogleMap.ApiKey = AppConfig.Key;
        string[] ports = SerialPort.GetPortNames();
        cBoxCom.Items.AddRange(ports);

        btnConnect.Enabled = true;
        btnDisconnect.Enabled = false;

        
        gMap.MapProvider = GMapProviders.GoogleMap;
        gMap.ShowCenter = false;
        gMap.DragButton = MouseButtons.Left;
        gMap.SetPositionByKeywords("Chennai, India");

    }

    private void btnConnect_Click(object sender, EventArgs e)
    {
        serialPort1.PortName = cBoxCom.Text;
        serialPort1.BaudRate = Convert.ToInt32(cBoxBaudrate.Text);
        btnConnect.Enabled = false; 
        btnDisconnect.Enabled = true;
        serialPort1.Open();
    }

    private void btnDisconnect_Click(object sender, EventArgs e)
    {
        if (serialPort1.IsOpen)         
        {
            serialPort1.Close();

            btnConnect.Enabled = true;    
            btnDisconnect.Enabled = false;  

        }
    }

    private void btnClearDataIn_Click(object sender, EventArgs e)
    {
        if (richBoxReciever.Text != "")
        {
            richBoxReciever.Text = " ";
        }
    }

    private void serialPort1_DataReceived(object sender, SerialDataReceivedEventArgs e)
    {
        dataIn = serialPort1.ReadExisting();
        this.Invoke(new EventHandler(ShowData));
    }
    private void ShowData(object sender, EventArgs e)
    {                     
            Thread.Sleep(3000);
            richBoxReciever.Text += dataIn;          
            
            Thread.Sleep(5000);
            string[] locationData = dataIn.Split(new char[] { ';' });
            List<string> tokens = new List<string>();
            foreach (string s in locationData)
            {
                if (s.Length != 0)
                {
                    tokens.Add(s);
                }
            }

            txtLat.Text = tokens[0];
            txtLon.Text = tokens[1];
    }

