【发布时间】:2014-10-08 14:04:52
【问题描述】:
我有两个不同的用户控件类。我正在尝试通过另一个用户控件为一个用户控件设置文本框文本。我的财产的获取正在工作,但集合没有做任何事情。如何解决这个问题?我在下面贴了相关代码sn-ps。
incidentCategorySearchControl.cs
public partial class incidentCategorySearchControl : UserControl
{
private void dataGridView_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
{
incidentCategoryChange incCatChange = new incidentCategoryChange();
//textBox1.Text = incCatChange.TextBoxCategory; // works
incCatChange.TextBoxCategory="test"; // doesn't work
}
}
incidentCategoryChange.cs
public partial class incidentCategoryChange : UserControl
{
public incidentCategoryChange()
{
InitializeComponent();
}
public string TextBoxCategory
{
get { return incidentCategoryTextBox.Text; }
set { incidentCategoryTextBox.Text = value; }
}
}
【问题讨论】:
标签: c# user-controls