private void Barcode(object sender, EventArgs e) { if (((MainForm)this.MdiParent).ActiveMdiChild == this) { List <int> CheckList = new List <int>(); foreach (DataGridViewRow row in dgvCompanyList.Rows) { DataGridViewCheckBoxCell chk = (DataGridViewCheckBoxCell)dgvCompanyList[0, row.Index]; if (chk.Value == null) { continue; } else if ((bool)chk.Value == true) { CheckList.Add(dgvCompanyList[1, row.Index].Value.ToInt()); } } if (CheckList.Count == 0) { MessageBox.Show("거래처를 선택하여 주세요."); return; } string selList = string.Join(",", CheckList); CompanyService service = new CompanyService(); DataTable dt = service.CompanyPrint(selList); CompanyReport xtra = new CompanyReport(); xtra.DataSource = dt; ReportPreviewForm frm = new ReportPreviewForm(xtra); } }