I'm having a problem when trying to pass object from one Form to another.
object y = new object(textBox1.Text, textBox2.Text);
Form2 newWin = new Form2();
newWin.Show();
I just want to send the object y to form2 from form 1
EDIT:
this is what i've write in form 1:
Preformer y = new Preformer(artName.Text, hitSong.Text);
preformerForm newPreformerWin = new preformerForm(y);
newPreformerWin.Show();
and this is what i've write in form2 (this called preformerForm):
public partial class preformerForm : Form
{
Preformer z;
public preformerForm()
{
InitializeComponent();
}
preformerForm(Preformer y)
{
this.z = y;
}
}
I just want to use the object 'y' in Form 2 and it's not working. I have a error in form 1 :