private void addbtn_Click(object sender, EventArgs e) { if (this.cboBusTime.Text == "" || this.cboBus.Text == "") { MessageBox.Show("校車時段或校車車號不可為空,請重新選擇!"); return; } else { //取得被選取的校車站名物件 BusStop bus = new BusStop(); bus.BusTimeName = this.cboBusTime.Text; bus.BusNumber = this.cboBus.Text; //開啟畫面 BusDetailForm frm = new BusDetailForm(); frm.SetBus(bus); frm.ShowDialog(); this.reloadData(); } }
private void editbtn_Click(object sender, EventArgs e) { if (this.BusStopView.SelectedItems.Count == 0) { MessageBox.Show("請選擇要修改的校車站名!"); return; } //取得被選取的校車站名物件 BusStop bus = (BusStop)this.BusStopView.SelectedItems[0].Tag; //開啟畫面 BusDetailForm frm = new BusDetailForm(); frm.SetBus(bus); frm.ShowDialog(); this.reloadData(); }