How to change a label from another class? c# windows forms visual studio

后端 未结 4 719
旧巷少年郎
旧巷少年郎 2021-01-28 01:25

I know there are a lot of threads talking about this and believe me I\'ve seen all of them, but I think I\'m a little slow and cant figure out how to do this so here is the thin

4条回答
  •  無奈伤痛
    2021-01-28 01:34

    I know this is 2 years ago but couldnt you just do this

    public static void function(label l)
      {
        l.Text = "Changed text"
      }
    

    and then in the Form do

    private void timer_tick(object sender, EventArgs e)
    {
        function(label);
    }
    

提交回复
热议问题