本文介绍了添加两个包含int值的标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个不同形式的标签。表单4和form6,

包含两个int值,我想添加那个int值并显示在form4中,

所以我在发件人表单中这样做了这是form6,

这段代码是正确的并且它没有产生任何错误,所以为什么不在表格中更新标签4

此代码在按钮点击中事件

< pre> private void button2_Click(object sender,EventArgs e)
{

Form4 fl = new Form4();
int f;
f = Convert.ToInt32(labelofform6.Text);
int g;
g = Convert.ToInt32(fl.labelofform4.Text);
fl.label1.Text = f.ToString()+ g.ToString();
}

;

解决方案



i have two labels in different form. form 4 and form6,
which contains two int value, i want to add that int value and show up in the form4,
so i have done this in the sender form which is form6,
this code is correct and it is not generating any error, so why not the label is not updating in the form4
this code is in the button click event

<pre>private void button2_Click(object sender, EventArgs e)
     {

         Form4 fl = new Form4();
         int f;
         f = Convert.ToInt32(labelofform6.Text);
         int g;
         g = Convert.ToInt32(fl.labelofform4.Text);
        fl.label1.Text= f.ToString() + g.ToString() ;
     }

;

解决方案



这篇关于添加两个包含int值的标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-12 17:01