private void btnOrdersTime_Click(object sender, EventArgs e) { DateTime FromDate = this.dtpFrom.Value; DateTime ToDate = this.dtpTo.Value; //DateTime FromDate = DateTime.Parse(txtFrom.Text); //DateTime ToDate = DateTime.Parse(txtTo.Text); CustomerOrders custOrder = new CustomerOrders(this); this.Hide(); custOrder.OrdersWithinTime(custrep, FromDate, ToDate); //var cust = custrep.OrderTime(FromDate,ToDate); //foreach (Customer aCustomer in cust) //{ // lbxcustomerNotDelivered.Items.Add(aCustomer); //} //this.ShowDialog(); }