You probably don’t want to return an exception from that method. It could use a void
return type instead. For example:
private void button1_Click(object sender, EventArgs e)
{
Student student = new Student();//set up student obj...
string city = "Foo";
searchCity(student, city);
}
public void searchCity(Student student, string searchCity)
{
//Do your search...
//set the data source of your gridview
dataGridView1.DataSource = City;
dataGridView1.DataBind(); //Make sure you call databind
}
0
solved Calling a function and text box from a button