Answer the question
In order to leave comments, you need to log in
How to update a form from another class on an event?
what I currently have
class form1.cs
start on click
private void StartGetQuery_Click(object sender, EventArgs e)
{
var QB = new QueryBig();
QB.StartLoaded();
}
// обновляем форму
public void LogShow(string LogString)
{
StatusStringPars.Text = String.Format(LogString);
}
public void getNewMesQuery()
{
Dictionary<string, Object> MesageArr = new Dictionary<string, Object>(1);
string response = getSendDataServer(MesageArr, "http://api.spmail/get/query");
var MaFrame = new Form1();
MaFrame.LogShow("response");
}
private void OnTimedEvent(Object source, System.Timers.ElapsedEventArgs e)
{
this.getNewMesQuery();
}
// таймер
private static System.Timers.Timer p_Timer;
public void StartLoaded()
{
p_Timer = new System.Timers.Timer(1000);
p_Timer.Elapsed += new ElapsedEventHandler(OnTimedEvent);
p_Timer.Enabled = true;
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question