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 Form3 : Form { public Form3() { InitializeComponent(); } private void Form3_Load(object sender, EventArgs e) { } private void button1_Click(object sender, EventArgs e) { dataGridView1.Rows.Clear(); API api = new API(); // 도서명, 저자, 출판사 string[] ArrayValue = { tb_book_name.Text, tb_author.Text, tb_book_comp.Text }; // 도서명 / 저자 / 출판사 / isbn / 정가 // 발행일 / 도서분류 / 재고 string[] param = { "title", "author", "publisher", "isbn", "price", "pubdate", "discount" }; string result = api.Naver(ArrayValue, param); richTextBox1.Text = result; input_Grid(result); } private void input_Grid(string value) { value = value.Replace("", ""); value = value.Replace("", ""); string[] sp_data = value.Split('\t'); string[] grid = { "", "", "", "", "", "", "" }; for (int a = 0; a < sp_data.Length; a++) { string[] data = sp_data[a].Split('|'); label3.Text = data.Length.ToString(); if (data.Length > 8) { int idx = data.Length - 2; grid[0] = data[0]; grid[1] = data[1]; for (int b = 2; b < idx - 4; b++) { grid[1] += ", " + data[b]; } grid[2] = data[idx-4]; if(data[idx-3].Contains(" ") == true) { string[] isbn = data[idx - 3].Split(' '); grid[3] = isbn[1]; } else grid[3] = data[idx -3]; grid[4] = data[idx - 2]; grid[5] = data[idx - 1]; if(data[idx] == "") grid[6] = "절판"; else grid[6] = data[idx]; dataGridView1.Rows.Add(grid); } else if (data.Length > 3) { dataGridView1.Rows.Add(data); } } } private void tb_book_name_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { button1_Click(null, null); } } } }