public PurchaseMainGrid(PurchaseGrid parent) { InitializeComponent(); foreach (DataGridViewColumn column in parent.dataGridView1.Columns) { dataGridView.Columns.Add(column.Clone() as DataGridViewColumn); } foreach (DataGridViewRow row in parent.dataGridView1.SelectedRows) { int index = dataGridView.Rows.Add(row.Clone() as DataGridViewRow); foreach (DataGridViewCell cell in row.Cells) { dataGridView.Rows[index].Cells[cell.ColumnIndex].Value = cell.Value; } } dataGridView.BorderStyle = BorderStyle.Fixed3D; dataGridView.AlternatingRowsDefaultCellStyle.BackColor = Color.NavajoWhite; dataGridView.CellBorderStyle = DataGridViewCellBorderStyle.Single; dataGridView.DefaultCellStyle.SelectionBackColor = Color.DarkTurquoise; dataGridView.DefaultCellStyle.SelectionForeColor = Color.WhiteSmoke; dataGridView.BackgroundColor = Color.Lavender; dataGridView.EnableHeadersVisualStyles = false; dataGridView.ColumnHeadersBorderStyle = DataGridViewHeaderBorderStyle.Sunken; dataGridView.ColumnHeadersDefaultCellStyle.BackColor = Color.DimGray; dataGridView.ColumnHeadersDefaultCellStyle.ForeColor = Color.White; }
private void button18_Click(object sender, EventArgs e) { SetValueForText1 = textBox1.Text; SetValueForText2 = textBox3.Text; SetValueForText3 = textBox4.Text; SetValueForText5 = textBox6.Text; SetValueForText8 = textBox9.Text; SetValueForText9 = textBox10.Text; //this.Hide(); PurchaseGrid pg = new PurchaseGrid(); pg.Show(); }