Click here to Skip to main content
15,867,453 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I already sent the data of the textbox in the label that is in another form but what I want is, I want to click that button again then send the result to another label.

What I have tried:

I tried this:

this is my code

Form 1's code - this is the receiver

    public partial class Form1 : Form
    {

        public string IDD { get; set; }
        public string CN { get; set; }
        public string ADD { get; set; }
        public string TIME { get; set; }

        
      
        public Form1()
        {
            InitializeComponent();
            
        }

     private void Form1_Load(object sender, EventArgs e)
        {
            ClientID.Text = IDD;
            ClientName.Text = CN;
            ClientAdd.Text = ADD;
            ClientTime.Text = TIME;

            

        }


Form 2's code - this is the sender

    private void btnBack_Click(object sender, EventArgs e)
        {

         
          
            Form1 frm1 = new Form1();

            frm1.IDD = txtID.Text;
            frm1.CN = txtCN.Text;
            frm1.ADD = txtAdd.Text;
            frm1.TIME = dateTimePicker1.Text;
            
            frm1.ShowDialog();

           
           

         
            
           
            
        }
Posted
Updated 18-Jan-22 5:35am

1 solution

See this series of Tips on how to send data between forms Transferring information between two forms, Part 1: Parent to Child[^]
 
Share this answer
 

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