private void CheckFile(object sender, EventArgs e) { int size; try { size = File.ReadAllBytes((sender as TextBox).Text).Length; } catch { size = -1; }; (sender == Video1 ? panel1 : panel2).BackColor = BVBreaker.checkvideosize(size) ? Color.LightGreen : Color.LightPink; B_Dump.Enabled = panel1.BackColor == Color.LightGreen && panel2.BackColor == Color.LightGreen; }