[C#] Use a listBox from a Class.
#11


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();



Forum Jump:


Users browsing this thread: 1 Guest(s)