Hello,
Xav said that before, but let me show you an example.
Do you know anything about fields?
OK, let me explain.
Assume you have a form named form2:
Code:
namespace Test
{
public partial class form2 : Form
{
public string textField; // This is a Field.
public form1() // Here's your constructor.
{
InitializeComponenets();
}
private void SetField()
{
this.textField = textBox1.Text; // You're filling your textField Field here.
}
}
}
And you can access PUBLIC fields, everywhere you want by create an instance from its owner.
Now assume you have another form named form1:
Code:
namespace Test
{
public partial class form1 : Form
{
public form1()
{
InitializeComponents();
}
private void fillListView()
{
form2 f2 = new form2();
f2.ShowDialog();
string[] items = {f2.textField, "subItem1", "subItem2" /*, ... */};
ListViewItem lvi = new ListViewItem(items);
listView1.Items.Add(lvi);
}
}
}
Look at f2.textField. You filled it in form2 from your textBoxes, and you're using it in form1.
Bookmarks
Algorithms and Data Structures
Java tutorials
Algorithms Forum