After Much Playing around i discovered there there where invisible character in my textbox so using
textBox1.Text = textBox1.Text.Trim();
This got rid of the invisible characters allowing the padding to work correctly, i then changed my data received event to be on a timer to avoid cross thread issues like this
private void timer3_Tick(object sender, EventArgs e)
{
data = comport.ReadExisting();
try
{
if (data != "")
{
textBox1.Clear();
textBox1.AppendText(data);
timer3.Stop();
scan();
timer3.Start();
}
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
comport.DiscardInBuffer();
}
My program is now working like i need. Thank you user2019047 for your help