private void cmdAddnum_Click(object sender, EventArgs e) { Server.Service1 server = new Server.Service1(); bool update; bool updatePassed; server.update(txtOldbus.Text, txtOldroute.Text, txtBusNumber.Text, txtRouteNumber.Text, out update, out updatePassed); if (update) { MessageBox.Show("route updated"); Server.Service1 myserver = new Server.Service1(); BindingSource bs = new BindingSource(); bs.DataSource = myserver.getbusroute(); dataGridView1.DataSource = bs; dataGridView1.Columns[2].Visible = false; dataGridView1.Columns[3].Visible = false; dataGridView1.Columns[5].Visible = false; dataGridView1.Columns[6].Visible = false; } else { MessageBox.Show("route not founded .Please enter valid bus number and route number"); } }