user3076791
user3076791

Reputation: 5

Pass data from one form to next

First form a couple of textboxes with Id, Name, Address, phonenumber

I want these to follow to the next form that has the same textboxes and a couple of more with message and extra and then choose between active and closed. Then I want it to be in different listviews. One with all the active and one with all the closed ones.

I want to be able to get all the info when I press one of the saved in the listviews. Can anyone help me?

Upvotes: 0

Views: 100

Answers (3)

senthilkumar2185
senthilkumar2185

Reputation: 2566

Form1 Code

 private void button1_Click(object sender, EventArgs e)
 {
            frm2 frmnew2 = new frm2();
            frmnew2.Id = Convert.ToInt32(TxtId.Text);
            frmnew2.EmpName = TxtName.Text;
            frmnew2.Add = TxtAdd.Text;
            this.Hide();
            frmnew2.Show();
 }

Form2 Code

    public Int32 Id { get; set; }
    public string EmpName { get; set; }
    public string Add { get; set; }

   private void frm2_Load(object sender, EventArgs e)
   {
           TxtId.Text = Id.ToString();
           TxtName.Text =EmpName;
           TxtAdd.Text = Add;
    }

Upvotes: 0

gaurav5430
gaurav5430

Reputation: 13892

what do you mean by active and closed?

for passing data between forms you can see this for a headstart : http://www.codeproject.com/Articles/14122/Passing-Data-Between-Forms

Upvotes: 2

Related Questions