Because there is no managed method to activate another application, you can either use this class within the current application or use native Windows methods, such as FindWindow and SetForegroundWindow, to force focus on other applications.
public class Ctls{
public const string Text = "System.Windows.Forms.TextBox Text: ";
}
if(Ctls.Text == obj.Name) /* do something*/;
Єсть строка var obj = (Control)sender; надо узнать кокой компонент шас находиться в obj например Label или TextBox.
if(sender is Label){
}
else if(sender is TextBox){
}
else{
// что то по умолчанию
}
private static int _interval = 60;
private static DatabaseCtx _ctx = DatabaseCtx.Instance;
public static BindingList<Data> Items { get; set; } = new BindingList<Data>();
public ExportGridForm()
{
InitializeComponent();
ReloadData();
bindingSource1.DataSource = Items;
}
private void ReloadData()
{
Items.Clear();
foreach (var data in _ctx.GetDatas()) Items.Add(data);
}