![]() |
|
[C#] Use a listBox from a Class. - Printable Version +- LCKB (https://lckb.dev/forum) +-- Forum: ** OLD LCKB DATABASE ** (https://lckb.dev/forum/forumdisplay.php?fid=109) +--- Forum: Programmers Gateway (https://lckb.dev/forum/forumdisplay.php?fid=196) +---- Forum: Coders Talk (https://lckb.dev/forum/forumdisplay.php?fid=192) +---- Thread: [C#] Use a listBox from a Class. (/showthread.php?tid=1035) Pages:
1
2
|
- someone - 08-20-2012 no, i made a Class "MySql1" for my Commands etc.. But now i wanna fill the listBox from Form1 .. and it wont work .. i try now wizas recommend You can get the Instance from the Form1 using the Singleton method, public partial class Form1 : Form { private static Form1 instance = null; public Form1() { InitializeComponent(); instance = this; } public static Form1 getInstance() { if(instance == null){ instance = new Form1(); } return instance; } } Accessing the data would be : windowsForm = Form1.getInstance(); windowsForm.do_stuff(); |