有个功能是这样,界面A弹出界面B,在界面B选值后传回界面A,
界面A: CIS_MAIN
private void comboBox2_DropDown(object sender, EventArgs e)
{
sp = comboBox2.Text;
商品模查 商品模查0 = new 商品模查();
商品模查0.GetForm(this);
商品模查0.Show();
}界面B: 商品模查
public CIS_MAIN 商品模查0 = null;
public void GetForm(CIS_MAIN theform)
{
商品模查0 = theform;
}
private void dataGridView1_CellContentDoubleClick(object sender, DataGridViewCellEventArgs e)
{
商品模查0.comboBox2.Text = dataGridView1.CurrentRow.Cells[0].Value.ToString();
商品模查0.textBox5.Text = dataGridView1.CurrentRow.Cells[2].Value.ToString();
商品模查0.textBox6.Text = dataGridView1.CurrentRow.Cells[3].Value.ToString();
this.Close();
}现在界面C:也要使用界面B的功能,但B的语句是写死的,有什么办法加个变量弄成通用的.
界面A: CIS_MAIN
private void comboBox2_DropDown(object sender, EventArgs e)
{
sp = comboBox2.Text;
商品模查 商品模查0 = new 商品模查();
商品模查0.GetForm(this);
商品模查0.Show();
}界面B: 商品模查
public CIS_MAIN 商品模查0 = null;
public void GetForm(CIS_MAIN theform)
{
商品模查0 = theform;
}
private void dataGridView1_CellContentDoubleClick(object sender, DataGridViewCellEventArgs e)
{
商品模查0.comboBox2.Text = dataGridView1.CurrentRow.Cells[0].Value.ToString();
商品模查0.textBox5.Text = dataGridView1.CurrentRow.Cells[2].Value.ToString();
商品模查0.textBox6.Text = dataGridView1.CurrentRow.Cells[3].Value.ToString();
this.Close();
}现在界面C:也要使用界面B的功能,但B的语句是写死的,有什么办法加个变量弄成通用的.
{
//方法
}c里B.aa();
http://topic.csdn.net/u/20100106/20/e9697297-75f9-4450-aaa9-da0da416cf41.html?39668
private static string *****;
publlic static string *****{
get{};
set{};
}或者直接用公有的静态变量
FORM2 FR2 = new FORM2();
FR2.Owner = this;
FR2.ShowDialog();
FORM2.CS:
Form1 FR1;
FR1= (DnNote_Form)this.Owner;
FR1.方法(參數); //你需要用到參數的方法.