/// <summary> /// invoice date fills combo box, fills grid with user selection /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void invoiceDateComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { try { sDate = invoiceDateComboBox.Text; ///Disable other drop down menu's if this is selected if (invoiceDateComboBox.IsEnabled) { invoiceIDComboBox.IsEnabled = false; invoiceAmountComboBox.IsEnabled = false; } ///The two other drop down menu's will be disabled when this is being used ///When selected, this combo box will show a drop down list with invoice Dates ///The user will be able to highlight/select a date and it will be received ///by the dataGrid1 to show that specific invoice only /// String selectedItem = invoiceDateComboBox.SelectedItem.ToString(); Console.WriteLine("Searching Date Value before: " + selectedItem); //remove timestamps from selectedItem var newSelItem = selectedItem.Split(' ')[0]; Console.WriteLine("Searching Date Value After: " + newSelItem); //get query needed find invoice String query = mydb.SelectInvoiceDate2(newSelItem); Console.WriteLine(query); String sQuery = mydb.SelectInvoiceDate2(invoiceDateComboBox.SelectedItem.ToString()); //datatable used to get table data. dt = db.FillSqlDataTable(sQuery); //fill the datagrid invoiceGrid1.ItemsSource = dt.DefaultView; } catch (Exception) { MessageBox.Show(MethodInfo.GetCurrentMethod().DeclaringType.Name); } }