private void LvwMonthView_ItemSelectionChanged(object sender, ListViewItemSelectionChangedEventArgs e) { DataTable dispatches; ListViewItem selectedItem = e.Item; ListViewItem.ListViewSubItem subItem = selectedItem.SubItems[3]; string text = subItem.Text; int year = Convert.ToInt32(text.Split('-').ElementAt(0)); int month = Convert.ToInt32(text.Split('-').ElementAt(1)); LvwDetailView.Items.Clear(); dispatches = selectedStaff.QueryLabourHourDetails(year, month, selectedStaff.ID, factory); ShowDetailedList(dispatches); }