“Global variable” in Visual C#

前端 未结 5 1227
眼角桃花
眼角桃花 2021-01-23 21:26

I have made the Graph class, and i want to simulate a distribution network. The Graph works 100%. But, i want to use that same struct/class in all my application! For example: I

5条回答
  •  死守一世寂寞
    2021-01-23 21:32

    Give the forms a reference to the Graph in their constructor.

     Graph g = new Graph();
     Form1 f1 = new Form1(g);
     Form2 f2 = new Form2(g);
    

    Then both forms are working with the same graph.

提交回复
热议问题