private void Add_Item(string name, string path, string extension) { this.Invoke((System.Action)(() => { F_SearchedFile = new SearchedFile(Item_Panel); F_SearchedFile.TopLevel = false; F_SearchedFile.Dock = System.Windows.Forms.DockStyle.Top; F_SearchedFile.FileName_Label.Text = name; F_SearchedFile.FilePath_Label.Text = path; sf.Add(F_SearchedFile); if (Array.IndexOf(txtExtensions, extension) != -1) { F_SearchedFile.Extension_Picture.Image = F_SearchedFile.il.Images[0]; } else if (Array.IndexOf(pdfExtensions, extension) != -1) { F_SearchedFile.Extension_Picture.Image = F_SearchedFile.il.Images[1]; } else if (Array.IndexOf(hwpExtensions, extension) != -1) { F_SearchedFile.Extension_Picture.Image = F_SearchedFile.il.Images[2]; } else if (Array.IndexOf(docxExtensions, extension) != -1) { F_SearchedFile.Extension_Picture.Image = F_SearchedFile.il.Images[3]; } else { } Item_Panel.Controls.Add(F_SearchedFile); F_SearchedFile.Show(); } )); //Console.WriteLine("Test: " + path); }