아래 부분 소스에서 에러가 발생하는데요
왜 발생하는지 모르겠어요!!
아시는분 좀 가르켜 주세요~~~~~
전체 소스 첨부~~~
private void btnAdd_Click(object sender, System.EventArgs e)
{
string name = txtName.Text.Trim();
string kor = txtKor.Text.Trim();
string eng = txtEng.Text.Trim();
string math = txtMath.Text.Trim();
if(name != "" && kor != "" && eng != "" && math != "")
{
try
{
int kk = Convert.ToInt32(kor);
int ee = Convert.ToInt32(eng);
int mm = Convert.ToInt32(math);
DataRow row = tbl.NewRow(); ----- > 이부분에서 Exception 발생
row["Name"] = "name";
row["Kor"] = kk;
row["Eng"] = ee;
row["Math"] = mm;
row["Avg"] = (kk + ee + mm)/3.0;
tbl.Rows.Add(row);
}
catch(Exception ex)
{
MessageBox.Show(ex.Message);
//MessageBox.Show("국/영/수 성적이 잘못 입력되었습니다!");
}
}
else
{
MessageBox.Show("이름, 국/영/수 성적을 입력하세요!");
}
}