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



Messages In This Thread
[No subject] - by Nikolee - 08-20-2012, 12:07 PM
[No subject] - by HateMe - 08-20-2012, 01:10 PM
[No subject] - by Nikolee - 08-20-2012, 01:45 PM
[No subject] - by Wizatek - 08-20-2012, 01:51 PM
[No subject] - by Nikolee - 08-20-2012, 02:19 PM
[No subject] - by HateMe - 08-20-2012, 03:07 PM
[No subject] - by Nikolee - 08-20-2012, 03:15 PM
[No subject] - by Wizatek - 08-20-2012, 04:02 PM
[No subject] - by someone - 08-20-2012, 04:34 PM
[No subject] - by Nikolee - 08-20-2012, 04:52 PM
[No subject] - by someone - 08-20-2012, 05:05 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)