how to give same property to all textboxes present in the same form.
foreach (var textbox in this.Controls.OfType()) { t
Try:
private void CtxMenu(Control parent) { foreach (Control child in parent.Controls) { if (child is TextBox) { (child as TextBox).ContextMenu = new ContextMenu(); } }