private void btnShow_Click(object sender, EventArgs e) { localhost.Service1 ser = new localhost.Service1(); bool isvalidSub; bool isvalidsubject; ser.isTeacherValidSubject(cmbSubject.Text, out isvalidsubject, out isvalidSub); BindingSource source = new BindingSource(); if (isvalidsubject) { source.DataSource = ser.TeacherViewDMC(cmbSubject.Text); ser.TeacherViewDMC(cmbSubject.Text); dataGridView1.DataSource = source; } else { MessageBox.Show("Invalid subject"); } }