//Picture Code ApplicationDataSet ApplicationInvoiceDataSet = new ApplicationDataSet(); ExportInvoiceCrystal ExportInvoiceInfo = new ExportInvoiceCrystal(); System.IO.MemoryStream SIMS = new System.IO.MemoryStream(); #region Image ExportInvoiceImage.Image.Save(SIMS, ExportInvoiceImage.Image.RawFormat); byte[] ExportByte = new byte[0]; ExportByte = SIMS.ToArray(); ApplicationInvoiceDataSet.ImageDataTable.Rows.Add(ExportByte); ExportInvoiceInfo.SetDataSource(ApplicationInvoiceDataSet.Tables["ImageDataTable"]); // ======================================================== // DataGridView Code DataSet DataGridDataSet = new DataSet(); DataTable DataGridDataTable = new DataTable(); DataGridDataTable.Columns.Add("ItemNo", typeof(Int64)); DataGridDataTable.Columns.Add("ItemName", typeof(string)); DataGridDataTable.Columns.Add("ItemQuantity", typeof(Int64)); DataGridDataTable.Columns.Add("ItemPrice", typeof(double)); DataGridDataTable.Columns.Add("ItemTotal", typeof(double)); foreach (DataGridViewRow DataGridRows in DataGridExportItem.Rows) { DataGridDataTable.Rows.Add(DataGridRows.Cells[0].Value, DataGridRows.Cells[1].Value, DataGridRows.Cells[2].Value, DataGridRows.Cells[3].Value, DataGridRows.Cells[4].Value); } DataGridDataSet.Tables.Add(DataGridDataTable); DataGridDataSet.WriteXmlSchema("ApplicationDataGrid.xml"); ExportInvoiceInfo.SetDataSource(DataGridDataSet);
DataSet
//Picture Code //... your code here... //Note: do not use SetDataSource yet! //DataGridView Code //... your code here... //finally //ApplicationInvoiceDataSet contains ["ImageDataTable"] already //add DataGridView data ApplicationInvoiceDataSet.Tables.Add(DataGridDataTable); ExportInvoiceInfo.SetDataSource(ApplicationInvoiceDataSet);
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)