简体   繁体   English

如何将文本框的数据发送到另一种形式的 label 然后再次单击该按钮,然后将其发送到另一个 label

[英]How to send the data of textbox to a label that is in another form then click that button again then send it in another label

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.我已经在 label 中以另一种形式发送了文本框的数据,但我想要的是,我想再次单击该按钮,然后将结果发送到另一个 label。

this is my code这是我的代码

Form 1's code - this is the receiver表格 1 的代码 - 这是接收方

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表格 2 的代码 - 这是发件人

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();

       
       

     
        
       
        
    }

You can do this by initializing parameterized constructors and holding them in auto-implemented properties.您可以通过初始化参数化构造函数并将它们保存在自动实现的属性中来做到这一点。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 将数据从列表框发送到其他表单上的标签 - Send data from a listbox to a label on another form 如何以其他形式在标签中显示文本框的值? - How to Display value of textbox in label in another form? 如何将动态Label发送到TableLayoutPanel的另一列 - How to send dynamic Label to another column of TableLayoutPanel 单击按钮后,以另一种形式刷新标签文本 - refresh label text in another form after button click C# 如何将日期从列表框发送到另一个表单的文本框 - How to send date from a listbox to textbox of another form 如何通过WAN C#将文本框文本发送到其他表单 - How to send textbox text to another form through WAN C# 如何将日期从文本框发送到其他表单的列表视图 - How to send date from a textbox to listview of another form 我正在尝试通过单击按钮使 label 以另一种形式消失,但我无法以我正在编写代码的形式访问此 label - I am trying to make a label disappear in another form on a button click but I cant access this label in the form i am writing the code in C#:如何在Visual Studio 2012中将诸如标签或文本框值之类的文本从窗体发送到Crystal报表? - C#: How to send text like label or textbox value from form to crystal reports in visual studio 2012? 单击按钮以使文本出现在另一个表单文本框中 - Click button for a text to appear in a another form textbox
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM