가격에 값이 없는 경우 발생하는 null 오류 수정

This commit is contained in:
SeungHo Yang
2025-08-20 20:43:34 +09:00
parent 405c1d9c46
commit 0cc71611d0
3 changed files with 4 additions and 3 deletions

View File

@@ -126,7 +126,7 @@ namespace ISBN_Check_test
string[,] grid = new string[dataGridView1.Rows.Count, 6];
for (int a = 0; a < dataGridView1.Rows.Count; a++)
{
string price = dataGridView1.Rows[a].Cells["price"].Value.ToString();
string price = dataGridView1.Rows[a].Cells["price"].Value?.ToString() ?? string.Empty;
int count = a + 1;
grid[a, 0] = count.ToString();
grid[a, 1] = dataGridView1.Rows[a].Cells["after_book_name"].Value.ToString();