Here's my code. When i try to call it from serialport.DataReceived event i
got random errors. One of them is that object reference is not set to an
instance of an object : in Application.Run(new Form1()) <- I don;t know even
why here. Like program wants to start again.
Anyway Rows.Clear() seems to cause the errors.
public void Fill_DataGrid()
{
ArrayList list = configFile.loadAllValues();
if (list != null)
{
string b = null, pat = null ;
dataGridView1.Rows.Clear();
foreach (String var in list)
{
b = var.Substring(0, var.IndexOf(' '));
pat = var.Substring(var.IndexOf(' '),
var.IndexOf("<p>") - var.IndexOf(' '));
if (var.Contains("."))
{
pat = Path.GetFileName(pat);
pat += " " + var.Substring(var.IndexOf("<p>") + 3);
}
int p = dataGridView1.Rows.Add();
dataGridView1.Rows[p].Cells[0].Value = b;
dataGridView1.Rows[p].Cells[1].Value = pat;
}
}
}
For any help really really thanks
Piotr