I am fairly new to c#, thank you for your help with this:
+ + + + + + + + +
public class frmMain : System.Windows.Forms.Form
{
public System.Windows.Forms.ListBox listBox1;
+ + + + + + + + +
ListboxMsgs lb = new ListboxMsgs();
//++ the reference to frmMain.listBox1 does not work: ++//
lb.test(frmMain.listBox1,"My message");
+ + + + + + + + +
using System;
using System.Windows.Forms;
namespace PagingDN
{
public class ListboxMsgs {
public void test(System.Windows.Forms.ListBox listBox1, string xMSG) {
listBox1.Items.Add(xMSG);
if(listBox1.Items.Count>300){
// listBox1.clear();
}
}
}
}
+ + + + + + + + +
"Ankur" <an***************@hotmail.com> wrote in message
news:ec**************@TK2MSFTNGP10.phx.gbl...
Cant you simply pass a reference to your listbox object to the that class
and use it to add items to the list?
"xzzy" <mr********@comcast.net> wrote in message
news:_AaTc.302186$XM6.87289@attbi_s53... how would I add items to a listbox from a function in a different class
in the solution?
i.e. something like:
namespace.frmMain.listBox1.items.add(0,"text to add");
Thank you