C#使用属性传递值给弹出窗口中的textbox
Form1--DG的住界面获取值(此处我用的是DevExpress的第三方控件)
namespace TestFormsApp
{
public partial class Main : DevExpress.XtraBars.Ribbon.RibbonForm
{
public Main()
{
InitializeComponent();
}
private void Main_Load(object sender, EventArgs e)
{
}
private void dataGridView1_CellDoubleClick_1(object sender, DataGridViewCellEventArgs e)
{
ItemDetailForm itemForm = new ItemDetailForm();
itemForm.Show();
itemForm.StrCode = dataGridView1.CurrentRow.Cells[0].Value.ToString();
}
private void btnItemData_ItemClick(object sender, ItemClickEventArgs e)
{
this.iTEM_DETAILTableAdapter.Fill(this.wineDataDataSet.ITEM_DETAIL);
}
}
}
Form2
namespace TestFormsApp
{
public partial class ItemDetailForm : DevExpress.XtraEditors.XtraForm
{
public ItemDetailForm()
{
InitializeComponent();
}
private string strCode;
public string StrCode
{
get
{
return strCode;
}
set
{
strCode = value;
}
}
private void ItemDetailForm_Load(object sender, EventArgs e)
{
txtitemCode.Text = strCode;
}
}
}