/// <summary> /// gets the inventory data from the database. /// I am also creating a dictionary to refer back to. I use this in the Add/Update click event. /// This prevents additional reads to the database to retrieve the ItemCode. /// </summary> public void populateInvoices() { try { //get data from database and load into datagrid1 //Method should be ran in initialize method //get query needed find invoice String sQuery = mydb.populateAllInvoices(); //datatable used to get table data. dt = db.FillSqlDataTable(sQuery); //fill the datagrid invoiceGrid1.ItemsSource = dt.DefaultView; } catch { } }//end populateInventory()