Click here to Skip to main content
15,908,581 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
HI...

I'm a beginner in C# and have a question.

This is the from class
namespace WindowsFormsApplication
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
    }
}

This is the working class named Class1...
namespace WindowsFormsApplication
{
    class Class1
    {
    }
}

I want to modifer added text to listbox from Class1? How can I do it?
Posted
Updated 20-Apr-11 14:07pm
v2
Comments
Tarakeshwar Reddy 20-Apr-11 20:08pm    
Added pre tags

1 solution

You need to implement some non-private (internal) method/property in the form; better yet, implement some interface in the form which does that. The interface should be visible to Class1, in all cases, you need your Class1 need to have to form instance reference.

For more detail on my approach, other options and the discussion, see this: How to copy all the items between listboxes in two forms[^].

This discussion is about two different forms, but it covers your case as well: one form and some separate class.

—SA
 
Share this answer
 
v2
Comments
guendouz bachir 20-Apr-11 19:06pm    
thank you Mr i will see it

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900