0

I want to save my text in a variable in my second form and when I select an item from the listbox it loads the second form and the corresponding text variable so it works as a task manager application.

The name of my first form is form1 and my second form is Description

Here is what I have and it does not work it says I require an object reference in Form1:

private void button1_Click(object sender, EventArgs e)

    {

        Tdo.addItem(textBox1.Text);

        this.Hide();
        string Dtext;
        Dtext = textBox2.Text;


    }

This is my second form code. Now this is my first form:

 private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
    {
       Description.Show();

       Description.textBox1.text = Description.Dtext
    }

I am very new to programming so think that i am in over my head so any help or a better way to do this would be appreciated thank you.

jdphenix
  • 15,022
  • 3
  • 41
  • 74
George Brooks
  • 199
  • 2
  • 17
  • This is a question a lot of newbees ask, there are many more duplicates on this site. Research ShowDialog (showing a Modal Form) – H H Apr 26 '15 at 23:27
  • @HenkHolterman Is there a canonical for that? – jdphenix Apr 26 '15 at 23:30
  • Not that I know of. And there are many variations, not sure if one answer should cover all that. – H H Apr 27 '15 at 09:03

0 Answers0