Form1
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication4
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
Form2 f2 = new Form2(this);
f2.ShowDialog();
}
{
Form2 f2 = new Form2(this);
f2.ShowDialog();
}
private void Form1_Load(object sender, EventArgs e)
{
dataGridView1.ColumnCount = 3;
}
}
}
{
dataGridView1.ColumnCount = 3;
}
}
}
Form2
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication4
{
public partial class Form2 : Form
{
public Form2(Form1 f1)
{
InitializeComponent();
this.Tag = f1;
}
{
public partial class Form2 : Form
{
public Form2(Form1 f1)
{
InitializeComponent();
this.Tag = f1;
}
private void Form2_Load(object sender, EventArgs e)
{
dataGridView1.ColumnCount = 2;
dataGridView1.Columns[0].Width = 50;
dataGridView1.Columns[0].HeaderText = "GG";
dataGridView1.Columns[1].HeaderText = "YY";
{
dataGridView1.ColumnCount = 2;
dataGridView1.Columns[0].Width = 50;
dataGridView1.Columns[0].
dataGridView1.Columns[1].
dataGridView1.Rows.Add("1", "1");
dataGridView1.Rows.Add("2", "2");
}
dataGridView1.Rows.Add("2", "2");
}
private void button1_Click(object sender, EventArgs e)
{
for (int i = 0; i < dataGridView1.Rows.Count - 1; i++)
{
((Form1)this.Tag).dataGridView1.Rows.Add(dataGridView1.Rows[i].Cells[0].Value, dataGridView1.Rows[i].Cells[1].Value,"未執行");
}
this.Close();
}
{
for (int i = 0; i < dataGridView1.Rows.Count - 1; i++)
{
((Form1)this.Tag).
}
this.Close();
}
}
}
沒有留言:
張貼留言