using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace ISBN_Check_test { public partial class Form2 : Form { Form1 f1; public int row; public Form2(Form1 _f1) { InitializeComponent(); f1 = _f1; } private void Form2_Load(object sender, EventArgs e) { string data = f1.dataGridView1.Rows[row].Cells["Column1"].Value.ToString(); // 도서명 / 저자 / 출판사 / isbn / 출간일 / 카테고리 / 품절여부 string[] tmp = data.Split('|'); string[] grid = { "", "", "", "", "", "", "", "" }; for(int a = 0; a < tmp.Length; a++) { if (a % 8 == 0) { grid[0] = tmp[a]; } if (a % 8 == 1) { grid[1] = tmp[a]; } if (a % 8 == 2) { grid[2] = tmp[a]; } if (a % 8 == 3) { grid[3] = tmp[a]; } if (a % 8 == 4) { grid[4] = tmp[a]; } if (a % 8 == 5) { grid[5] = tmp[a]; } if (a % 8 == 6) { grid[6] = tmp[a]; } if (a % 8 == 7) { grid[7] = tmp[a]; dataGridView1.Rows.Add(grid); } } } private void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { int rowidx = e.RowIndex; string book_name = dataGridView1.Rows[rowidx].Cells["book_name"].Value.ToString(); string author = dataGridView1.Rows[rowidx].Cells["author"].Value.ToString(); string book_comp = dataGridView1.Rows[rowidx].Cells["book_comp"].Value.ToString(); string isbn = dataGridView1.Rows[rowidx].Cells["isbn"].Value.ToString(); string price = dataGridView1.Rows[rowidx].Cells["price"].Value.ToString(); string Date = dataGridView1.Rows[rowidx].Cells["pubDate"].Value.ToString(); string category = dataGridView1.Rows[rowidx].Cells["category"].Value.ToString(); string sold = dataGridView1.Rows[rowidx].Cells["sold_out"].Value.ToString(); f1.dataGridView1.Rows[row].Cells["book_name"].Value = book_name; f1.dataGridView1.Rows[row].Cells["author"].Value = author; f1.dataGridView1.Rows[row].Cells["book_comp"].Value = book_comp; f1.dataGridView1.Rows[row].Cells["isbn"].Value = isbn; f1.dataGridView1.Rows[row].Cells["price"].Value = price; f1.dataGridView1.Rows[row].Cells["pubDate"].Value = Date; f1.dataGridView1.Rows[row].Cells["category"].Value = category; f1.dataGridView1.Rows[row].Cells["sold_out"].Value = sold; } } }