Guest User

Untitled

a guest
Oct 17th, 2017
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  1. txtQty.DataBindings.Add("Text", bsInvoiceDetails, "Detail_Quantity");
  2.  
  3. dsInvoiceDetails = new
  4. dsInvoiceDetails.Tables.Add(dtInvoiceDetails);
  5.  
  6. bsInvoiceDetails.DataSource = dsInvoiceDetails;
  7. bsInvoiceDetails.DataMember = "Invoice_Detail";
  8.  
  9. gridInvoiceDetails.DataSource = bsInvoiceDetails;
  10. bnInvoiceDetails.BindingSource = bsInvoiceDetails;
  11.  
  12. bsInvoiceDetails.AddingNew += new AddingNewEventHandler(bsInvoiceDetails_AddingNew);
  13.  
  14. void bsInvoiceDetails_AddingNew(object sender, AddingNewEventArgs e)
  15. {
  16. try
  17. {
  18. InvoiceDetail id = new InvoiceDetail();
  19. id.InvoiceID = invoice.InvoiceID; // Make sure we are hooked to this invoice.
  20. id.DetailDate = DateTime.Today;
  21. id.DetailQuantity = 0;
  22. id.DetailRate = 0;
  23. id.DetailTotal = 0;
  24. id.DetailDescription = "* New Detail Description *";
  25.  
  26. e.NewObject = id;
  27. }
  28. catch (Exception ex)
  29. {
  30. ErrorManager em = new ErrorManager(ex, "InvoiceEditForm.cs", "bsInvoiceDetails_ListChanged", "Adding a new detail item", "sql");
  31. }
  32. }
Add Comment
Please, Sign In to add comment