// 添加房间 private void btnAddRoom_Click(object sender, System.EventArgs e) { FrmRoomAdd frmRoomAdd = new FrmRoomAdd(); if (frmRoomAdd.ShowDialog() == DialogResult.OK) // 打开选择房间对话框 { List <Room> rooms = frmRoomAdd.Tag as List <Room>; // 获取选择的房间信息 foreach (Room room in rooms) // 插入选择的房间 { dgvRoom.Rows.Add( room.RoomNo, room.RoomType, room.BedNum); } } }
// 添加房间 private void btnAddRoom_Click(object sender, EventArgs e) { FrmRoomAdd frmRoomAdd = new FrmRoomAdd(); if (frmRoomAdd.ShowDialog() == DialogResult.OK) // 打开选择房间对话框 { List <Room> rooms = frmRoomAdd.Tag as List <Room>; // 获取选择的房间信息 foreach (Room room in rooms) // 插入选择的房间 { lvSelectedRooms.Items.Add(new ListViewItem(new string[] { room.RoomNo, room.RoomType, room.BedNum.ToString() })); } } }