/// <summary> /// Update the grid of the shared files. /// </summary> private void UpdateSharedFilesGrid() { DataGridViewRowCollection rows = this.SharedFilesGrid.Rows; if (this.InvokeRequired) { this.Invoke(new MethodInvoker(delegate { rows.Clear(); })); } else { rows.Clear(); } for (int i = 0; i < FilesList.Count; i++) { if (this.InvokeRequired) { this.Invoke(new MethodInvoker(delegate { rows.Add(FilesList.List[i].Name, FilesList.List[i].Size, FilesList.List[i].SHA1, FilesList.List[i].Path); })); } else { rows.Add(FilesList.List[i].Name, FilesList.List[i].Size, FilesList.List[i].SHA1, FilesList.List[i].Path); } } }
void LoadEntry(CompositeIsotopics comp_iso) { DataGridViewRowCollection rows = this.IsoDataGrid.Rows; rows.Clear(); string[] summ = new string[9]; summ[0] = comp_iso.pu_mass.ToString("F3"); summ[1] = comp_iso.pu238.ToString("F6"); summ[2] = comp_iso.pu239.ToString("F6"); summ[3] = comp_iso.pu240.ToString("F6"); summ[4] = comp_iso.pu241.ToString("F6"); summ[5] = comp_iso.pu242.ToString("F6"); summ[6] = comp_iso.pu_date.ToString("yyyy-MM-dd"); summ[7] = comp_iso.am241.ToString("F6"); summ[8] = comp_iso.am_date.ToString("yyyy-MM-dd"); rows.Add(summ); foreach (CompositeIsotopic ci in comp_iso.isotopicComponents) { string[] sub = new string[9]; sub[0] = ci.pu_mass.ToString("F3"); sub[1] = ci.pu238.ToString("F6"); sub[2] = ci.pu239.ToString("F6"); sub[3] = ci.pu240.ToString("F6"); sub[4] = ci.pu241.ToString("F6"); sub[5] = ci.pu242.ToString("F6"); sub[6] = ci.pu_date.ToString("yyyy-MM-dd"); sub[7] = ci.am241.ToString("F6"); sub[8] = ci.am_date.ToString("yyyy-MM-dd"); rows.Add(sub); } }
/// <summary> /// Update the grid of the downloads. /// </summary> private void UpdateDownloadGrid() { DataGridViewRowCollection rows = this.DownloadsGrid.Rows; if (this.InvokeRequired) { this.Invoke(new MethodInvoker(delegate { rows.Clear(); })); } else { rows.Clear(); } for (int i = 0; i < Downloader.Count; i++) { if (this.InvokeRequired) { this.Invoke(new MethodInvoker(delegate { rows.Add(Downloader.List[i].Name, Downloader.List[i].CurrentSize, Downloader.List[i].Progress, "SPEED", Downloader.List[i].Size, Downloader.List[i].SHA1); })); } else { rows.Add(Downloader.List[i].Name, (Downloader.List[i].Size - (Downloader.List[i].RemainingFilePacks * 16384)), Downloader.List[i].Progress, "SPEED", Downloader.List[i].Size, Downloader.List[i].SHA1); } } }
/// <summary> /// Fills left column of columns assignment data grid view /// with entries of Ogama aoi table database columns /// </summary> private void FillLeftAssignColumn() { DataGridViewRowCollection rows = this.dGVAssignments.Rows; rows.Clear(); string[] row0 = { "SubjectName", string.Empty }; string[] row1 = { "TrialSequence", string.Empty }; string[] row2 = { "TrialID", string.Empty }; string[] row3 = { "TrialImage", string.Empty }; string[] row4 = { "CountInTrial", string.Empty }; string[] row5 = { "StartTime", string.Empty }; string[] row6 = { "EndTime", string.Empty }; string[] row7 = { "Length", string.Empty }; string[] row8 = { "PosX", string.Empty }; string[] row9 = { "PosY", string.Empty }; rows.Add(row0); rows.Add(row1); rows.Add(row2); rows.Add(row3); rows.Add(row4); rows.Add(row5); rows.Add(row6); rows.Add(row7); rows.Add(row8); rows.Add(row9); }
private void loadData() { dgvInventory.Rows.Clear(); string info = ""; DataGridViewRowCollection rows = dgvInventory.Rows; InventoryInfo view = new InventoryInfo(APConfig.Conn); view.Conditions = " 1=1 "; view.Conditions += " AND " + view.getCondition(InventoryInfo.ncConditions.sernolist.ToString(), sernolist); view.OrderBy = view.getOptionOrderBy(InventoryInfo.ncOrderBy.ODBcode.ToString()); view.load(); while (!view.IsEof) { if (string.IsNullOrEmpty(view.INV_CODE)) { info = string.Format("寄庫品( 寄庫金額:{0:n0}元 / 寄庫時間:{1} )", view.INV_POSTAMT, view.INV_POSTDTTM.ToShortDateString()); rows.Add(new Object[] { view.INV_SERNO, view.INV_STATUS, true, info }); } else { rows.Add(new Object[] { view.INV_SERNO, view.INV_STATUS, true, view.INV_CODE }); } view.next(); } }
public Form1() { InitializeComponent(); DataGridViewRowCollection rows = dataGridView1.Rows; rows.Add(new Object[] { "TOP SM", 26.3 }); rows.Add(new Object[] { "Cu L1", 18.3 }); }
private void PushElements() { listref.Clear(); listBox.Columns.Clear(); listBox.Columns.Add("text", "Data"); listBox.Columns[0].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; foreach (string i in list) { listref.Add(i); } }
public Form1() { InitializeComponent(); // 填入銷售項目到菜單中 DataGridViewRowCollection rows = dataGridViewMenu.Rows; rows.Add(new Object[] { "紅茶", 25 }); rows.Add(new Object[] { "綠茶", 25 }); rows.Add(new Object[] { "奶茶", 30 }); rows.Add(new Object[] { "珍珠奶茶", 35 }); }
private void AddSingleTableData(DataGridViewRowCollection rows, string propertyName, object value, object defaultValue) { if (null == value) { rows.Add(false, propertyName, defaultValue.ToString()); } else { rows.Add(true, propertyName, value.ToString()); } }
private void GVaddrows(DataGridView GV, Herb Herb) { DataGridViewRowCollection gvRows = GV.Rows; //有比例的Column if (GV.ColumnCount == 4) { gvRows.Add(new Object[] { Herb.Name, Herb.Weight, Herb.Unit, Herb.Rate }); } else { gvRows.Add(new Object[] { Herb.Name, Herb.Weight, Herb.Unit }); } }
private void btnInsertRow_Click(object sender, EventArgs e) { DataGridViewRowCollection rows = this.dataGridView.Rows; switch (number) { case 0: rows.Add(row0); number++; break; case 1: rows.Add(row1); number++; break; case 2: rows.Add(row2); number++; break; default: break; } }
private void UpdateUserGroupList() { if (userGroup != null) { List <Role> roles = database.GetRoles(); DataGridViewRowCollection col = uxGroupTable.Rows; col.Clear(); foreach (KeyValuePair <User, Role> kvp in database.GetUsersInUserGroup(userGroup)) { DataGridViewRow row = new DataGridViewRow(); row.CreateCells(uxGroupTable); row.Cells[0].Value = kvp.Key; row.Cells[1].Value = kvp.Key.Email; row.Cells[2].Value = kvp.Value; col.Add(row); } uxGroupName.Text = userGroup.Name; uxOwner.Text = userGroup.Owner.Name; uxDescription.Text = userGroup.Description; } else { uxOwner.Text = user.Name; } }
private void Form1_Load(object sender, EventArgs e) { year = dt.Year; month = dt.Month; if (month < 10) { Month = "0" + month.ToString(); } Year = year.ToString(); excelid = Year + Month; path = @"D:\" + excelid + ".txt"; ShowTableWithGridview(); datetime(); if (File.Exists(path)) { string[] data = File.ReadAllLines(path); foreach (string s in data) { string[] datas = s.Split('+'); DataGridViewRowCollection rows = dataGridView1.Rows; rows.Add(datas[0], datas[1], datas[2], datas[3], datas[4], datas[5]); } } }
public IDDItemDataEntry() { newIDs = new List <ItemId>(); InitializeComponent(); buildlists(); DataGridViewColumnCollection dgvcc = ItemIdDataGrid.Columns; DataGridViewComboBoxColumn c = (DataGridViewComboBoxColumn)dgvcc["MBA"]; foreach (INCCDB.Descriptor desc in NC.App.DB.MBAs.GetList()) { c.Items.Add(desc.Name); } c = (DataGridViewComboBoxColumn)dgvcc["IsoId"]; foreach (string s in isotopics) { c.Items.Add(s); } c = (DataGridViewComboBoxColumn)dgvcc["MatType"]; foreach (string s in mats) { c.Items.Add(s); } c = (DataGridViewComboBoxColumn)dgvcc["StratId"]; foreach (string s in strats) { c.Items.Add(s); } c = (DataGridViewComboBoxColumn)dgvcc["IOCode"]; foreach (string s in iocodes) { c.Items.Add(s); } c = (DataGridViewComboBoxColumn)dgvcc["InvChangeCode"]; foreach (string s in invcodes) { c.Items.Add(s); } DataGridViewRowCollection rows = this.ItemIdDataGrid.Rows; foreach (ItemId ito in NC.App.DB.ItemIds.GetList()) { string[] a = ito.ToSimpleValueArray(); rows.Add(a); } // Generate a copy of the ItemId string in case the user changes it so we can tell what is a new row and what is a name change foreach (DataGridViewRow row in this.ItemIdDataGrid.Rows) { // Set the row's Tag member to a copy of the ItemId string row.Tag = (string)((DataGridViewTextBoxCell)row.Cells["ItemId"]).Value; } }
public void OnOverseaFuture(string strMsg) { DataGridViewRowCollection rows = GridProducts.Rows; string[] strRowData = strMsg.Split(';'); rows.Add(strRowData); }
private void ClickEachMealButtons(object sender, EventArgs e)//點擊『每個餐點按鈕』觸發的事件 { DataGridViewRowCollection rows = _dataGridViewOrders.Rows; Button buttonClicked = sender as Button; int counter = 1; for (int mealsearcher = 0; mealsearcher < _model._mealList.Count; mealsearcher++) { if (buttonClicked.Name == _model._mealList[mealsearcher]._mealText) { counter = mealsearcher; } } if (_model._mealList[counter]._mealsOrdered == 0) { _model._mealList[counter]._mealsOrdered = 1; rows.Add(new Object[] { "not important", _model._mealList[counter]._mealText, _model._mealList[counter]._mealCategory, _model._mealList[counter]._mealPrice, _model._mealList[counter]._mealsOrdered, _model._mealList[counter]._mealPrice * _model._mealList[counter]._mealsOrdered }); } else { _model._mealList[counter]._mealsOrdered++; foreach (DataGridViewRow existingRow in _dataGridViewOrders.Rows) { if (existingRow.Cells[1].Value != null) { if (existingRow.Cells[1].Value.ToString() == _model._mealList[counter]._mealText) { existingRow.Cells[MEAL_AMOUNT_INDEX].Value = Convert.ToInt32(existingRow.Cells[MEAL_AMOUNT_INDEX].Value) + 1; existingRow.Cells[SMALL_TOTAL_INDEX].Value = Convert.ToInt32(existingRow.Cells[MEAL_AMOUNT_INDEX].Value) * _model._mealList[counter]._mealPrice; } } } } _viewModel.UpdateTotal(_dataGridViewOrders, _labelTotal); }
public void get_course_table(String c_table) { string[] course_table = new string[6] { "", "", "", "", "", "" }; rows = dataGridView1.Rows; rows.Clear(); HtmlAgilityPack.HtmlDocument doc = new HtmlAgilityPack.HtmlDocument(); doc.LoadHtml(c_table); HtmlAgilityPack.HtmlNodeCollection nodes = doc.DocumentNode.SelectNodes("//table[@id='ctl00_MainContent_TabContainer1_tabCourseSearch_wcCourseSearch_gvWishListTimeTable']//tr"); //製作課表 for (int i = 1; i <= 14; i++) { HtmlAgilityPack.HtmlNode node = nodes[i]; for (int j = 1; j <= 6; j++) { if (node.ChildNodes[j].Attributes["class"].Value != "week" && node.ChildNodes[j].Attributes["class"].Value != "week w") { course_table[j - 1] = node.ChildNodes[j].InnerText; } } rows.Add(course_table[0], course_table[1], course_table[2], course_table[3], course_table[4], course_table[5]); Array.Clear(course_table, 0, course_table.Length); rows[i - 1].Resizable = DataGridViewTriState.False; } }
private void ItemSearch() { dgvItem.Rows.Clear(); DataGridViewRowCollection rows = dgvItem.Rows; InventoryInfo view = new InventoryInfo(APConfig.Conn); view.Conditions = " 1=1 "; view.Conditions += " AND " + view.getCondition(InventoryInfo.ncConditions.status.ToString(), InventoryStatus.庫存中.ToString()); if (!string.IsNullOrEmpty(txtName.Text)) { view.Conditions += " AND " + view.getCondition(InventoryInfo.ncConditions.LKverdor.ToString(), txtName.Text); } if (!string.IsNullOrEmpty(txtType.Text)) { view.Conditions += " AND " + view.getCondition(InventoryInfo.ncConditions.LKtype.ToString(), txtType.Text); } if (!string.IsNullOrEmpty(sernolist)) { view.Conditions += " AND " + view.getCondition(InventoryInfo.ncConditions.NINsernolist.ToString(), sernolist); } view.OrderBy = string.Format("{0} , {1}", view.getOptionOrderBy(InventoryInfo.ncOrderBy.ODBverdor.ToString()), view.getOptionOrderBy(InventoryInfo.ncOrderBy.ODBmodifydttm.ToString())); view.load(); while (!view.IsEof) { rows.Add(new Object[] { view.INV_SERNO, view.INV_VENDOR, view.INV_NAME, view.INV_TYPE, view.INV_COLOR, view.INV_INAMT, view.INV_INDTTM.ToShortDateString() }); view.next(); } }
void BuildRows() { DataGridViewRowCollection rows = ItemIdDataGrid.Rows; foreach (ItemId ito in NC.App.DB.ItemIds.GetList()) { string[] a = ToSimpleValueArray(ito); int i = rows.Add(a); rows[i].Cells[7].Tag = ito.declaredMass; rows[i].Cells[8].Tag = ito.declaredUMass; rows[i].Cells[9].Tag = ito.length; } // Generate a copy of the ItemId string in case the user changes it so we can tell what is a new row and what is a name change for (int i = 0; i < rows.Count; i++) { DataGridViewRow row = rows[i]; if (string.IsNullOrEmpty((string)((DataGridViewTextBoxCell)row.Cells["ItemId"]).Value)) { continue; } else { // Set the row's Tag member to a copy of the ItemId string row.Tag = string.Copy((string)((DataGridViewTextBoxCell)row.Cells["ItemId"]).Value); } } }
public static void LoadDatagridview(DataGridView dgv, string namePath) { try { List <string> list = File.ReadAllLines(namePath).ToList <string>(); bool flag = list.Count > 0; if (flag) { for (int i = 0; i < list.Count; i++) { string row = list[i]; DataGridViewRowCollection rows = dgv.Rows; object[] values = row.Split(new char[] { '|' }); rows.Add(values); } for (int j = 0; j < dgv.Rows.Count - 1; j++) { string dtgDieLive = dgv.Rows[j].Cells["cllive"].Value.ToString(); if (dtgDieLive == "Die") { dgv.Rows[j].DefaultCellStyle.BackColor = Color.Red; dgv.Rows[j].DefaultCellStyle.ForeColor = Color.White; } else { dgv.Rows[j].DefaultCellStyle.BackColor = Color.Green; dgv.Rows[j].DefaultCellStyle.ForeColor = Color.White; } } } } catch { } }
private void itemInfoAdd() { #region 判斷 string msg = ""; int n; if (string.IsNullOrEmpty(txtAmount.Text)) { msg = "請輸入金額"; } else if (string.IsNullOrEmpty(txtItemInfo.Text)) { msg = "請輸入商品資訊"; } else if (!int.TryParse(txtAmount.Text, out n)) { msg = "金額欄位請輸入數字"; } if (!string.IsNullOrEmpty(msg)) { APConfig.SweetAlert(ShowBoxType.alert, msg); return; } #endregion DataGridViewRowCollection rows = dgvItem.Rows; rows.Add(new Object[] { ddlType.SelectedItem.ToString(), txtItemInfo.Text, txtAmount.Text }); loadTotalAmount(); }
private void MostraDados() { // Create an unbound DataGridView by declaring a column count. gridCategorias.ColumnCount = 2; gridCategorias.ColumnHeadersVisible = true; // Set the column header style. DataGridViewCellStyle columnHeaderStyle = new DataGridViewCellStyle(); // Define o cabeçalho das colunas da grid gridCategorias.Columns[0].Name = "Categoria"; gridCategorias.Columns[1].Name = "Descrição"; //Criando um DataTable //DataTable dt = new DataTable(); //Lendo Todas as linhas do arquivo CSV //string[] Linha = System.IO.File.ReadAllLines(caminho.fullPath + "razaoSocial.txt + fornecedor.txt" + ""); string[] Linha = System.IO.File.ReadAllLines(caminho.fullPath + "categ&desc.txt"); DataGridViewRowCollection rows = this.gridCategorias.Rows; //Neste For, vamos percorrer todas as linhas que foram lidas do arquivo CSV for (int i = 0; i < Linha.Length; i++) { //Aqui Estamos pegando a linha atual, e separando os campos //Por exemplo, ele vai lendo um texto, e quando achar um ponto e virgula //ele pega o texto e joga na outra posição do array temp, e assim por diante //até chegar no final da linha string[] campos = Linha[i].Split(Convert.ToChar(";")); rows.Add(campos[0], campos[1]); } }
private void itemInfoAdd() { #region 判斷 string msg = ""; if (string.IsNullOrEmpty(txtAmount.Text)) { msg = "請輸入金額"; } else if (!int.TryParse(txtAmount.Text, out int n)) { msg = "金額欄位請輸入數字"; } else if (string.IsNullOrEmpty(txtName.Text)) { msg = "請選擇商品資訊"; } if (!string.IsNullOrEmpty(msg)) { APConfig.SweetAlert(ShowBoxType.alert, msg); return; } #endregion DataGridViewRowCollection rows = dgvItem.Rows; rows.Add(new Object[] { ddlVendor.SelectedItem.ToString(), txtName.Text, txtType.Text, txtColor.Text, txtSize.Text, txtAmount.Text, dpkImportDTTM.Value.ToShortDateString(), txtComment.Text }); clearPage(); loadTotalAmount(); }
/// <summary> /// Use the new data to fill this DataGridView. /// </summary> /// <param name="data">The data used to fill this DataGridView.</param> /// <exception cref="System.ArgumentException"><paramref name="data"/> is null.</exception> public virtual void Refresh(IEnumerable <T> data) { if (data == null) { throw new ArgumentException("data is null", "data"); } this.Clear(); DataGridViewRow row = null; DataGridViewRowCollection rows = this.DataGridView.Rows; this.OnPreCreateRows(); foreach (T info in data) { if (info == null) { continue; } row = rows[rows.Add()]; this.FillRow(info, row); } this.OnPostCreateRows(); this.DataGridView.ClearSelection(); if (this.DataGridView.Rows.Count > 0) { this.DataGridView.Rows[0].Selected = true; } }
private void ResourceGroupCombo_SelectedIndexChanged(object sender, EventArgs e) { // Grab the fields we'll want to pull MSProject.PjField colorFieldId = Globals.ThisAddIn.Application.FieldNameToFieldConstant(Globals.ThisAddIn.resourceColorField, MSProject.PjFieldType.pjResource); MSProject.PjField borderColorFieldId = Globals.ThisAddIn.Application.FieldNameToFieldConstant(Globals.ThisAddIn.resourceBorderColorField, MSProject.PjFieldType.pjResource); // Initialize the grid with the existing data String group = this.ResourceGroupCombo.SelectedItem.ToString(); DataGridViewRowCollection rows = this.ResourceColorGrid.Rows; rows.Clear(); int row = 0; foreach (MSProject.Resource res in Globals.ThisAddIn.Application.ActiveProject.Resources) { if (res.Group != group) { continue; } rows.Add(res.Name); rows[row].Cells[ColorColumn.Index].Style.BackColor = Globals.ThisAddIn.stringToColor(res.GetField(colorFieldId), Color.White); rows[row].Cells[ColorColumn.Index].Style.SelectionBackColor = Globals.ThisAddIn.stringToColor(res.GetField(colorFieldId), Color.White); rows[row].Cells[BorderColorColumn.Index].Style.BackColor = Globals.ThisAddIn.stringToColor(res.GetField(borderColorFieldId), Color.Black); rows[row].Cells[BorderColorColumn.Index].Style.SelectionBackColor = Globals.ThisAddIn.stringToColor(res.GetField(borderColorFieldId), Color.Black); row++; } }
/// <summary> /// Update the panel. /// </summary> public new void Update() { Thread t = new Thread(new ParameterizedThreadStart( delegate { DataGridViewRowCollection rows = FilesFoundGrid.Rows; // clear the dataGrid this.Invoke(new MethodInvoker(delegate { rows.Clear(); })); if (this.m_lastSearchedFile != null) { List <Lists.FilesFoundList.File> list = Lists.FilesFoundList.SearchFileByText(m_lastSearchedFile); for (int i = 0; i < list.Count; i++) { this.Invoke(new MethodInvoker(delegate { rows.Add(list[i].Name, Utilities.Converterer.AutoConvertSizeFromByte(list[i].Size), list[i].SHA1); })); } } } )); t.Name = "UpdateFileSearchPanel"; t.IsBackground = true; t.Start(); }
private void UpdateTaskList() { List <model.Task> tasks = database.GetTasksForUser(user); DataGridViewRowCollection col = uxTaskList.Rows; col.Clear(); foreach (model.Task task in tasks) { StringBuilder taskCategories = new StringBuilder(); foreach (TaskCategory tc in task.TaskCategories) { taskCategories.Append(tc.Name); taskCategories.Append(", "); } if (taskCategories.Length >= 2) { taskCategories.Length -= 2; } if ((uxFilterDateRange.Checked && task.DueDate >= uxDateRange.SelectionStart && task.DueDate < uxDateRange.SelectionEnd) || (uxFilterUserGroup.Checked && task.UserGroup.UserGroupID.Equals(((UserGroup)uxUserGroup.SelectedItem).UserGroupID)) || (uxFilterOwner.Checked && task.Owner.UserID.Equals(user.UserID)) || (uxFilterNotCompleted.Checked && task.CompletionDate == null) || (uxFilterName.Checked && task.Name.ToUpper().Contains(uxTaskName.Text.ToUpper())) || (!uxFilterDateRange.Checked && !uxFilterUserGroup.Checked && !uxFilterOwner.Checked && !uxFilterNotCompleted.Checked && !uxFilterName.Checked)) { col.Add(new object[] { task, task.CompletionDate != null ? "Completed" : task.TaskState.Name, taskCategories.ToString(), task.UserGroup.Name, task.Owner.Name, task.DueDate, task.StartDate, task.CompletionDate != null ? task.CompletionDate.ToString() : "Not Completed" }); } } }
void LoadSchemas() { if (this.cache == null) { if (this.Site != null) { this.cache = (SchemaCache)this.Site.GetService(typeof(SchemaCache)); } } items.Clear(); DataGridViewRowCollection col = this.dataGridView1.Rows; col.Clear(); if (this.cache != null) { foreach (CacheEntry e in this.cache.GetSchemas()) { Uri uri = e.Location; string filename = uri.IsFile ? uri.LocalPath : uri.AbsoluteUri; SchemaItem item = new SchemaItem(e.Disabled, e.TargetNamespace, filename); items.Add(item); int i = col.Add(item.Values); col[i].Tag = item; } } }
private void ItemSearch() { dgvItem.Rows.Clear(); DataGridViewRowCollection rows = dgvItem.Rows; InventoryInfo view = new InventoryInfo(APConfig.Conn); int totalamount = 0; view.Conditions = " 1=1 "; view.Conditions += " AND " + view.getCondition(InventoryInfo.ncConditions.status.ToString(), InventoryStatus.寄庫品.ToString()); if (!string.IsNullOrEmpty(txtName.Text)) { view.Conditions += " AND " + view.getCondition(InventoryInfo.ncConditions.LKname.ToString(), txtName.Text); } if (!string.IsNullOrEmpty(sernolist)) { view.Conditions += " AND " + view.getCondition(InventoryInfo.ncConditions.NINsernolist.ToString(), sernolist); } view.OrderBy = view.getOptionOrderBy(InventoryInfo.ncOrderBy.ODBname.ToString()); view.load(); while (!view.IsEof) { rows.Add(new Object[] { view.INV_SERNO, view.INV_NAME, view.INV_POSTAMT, view.INV_POSTDTTM.ToShortDateString() }); totalamount += view.INV_POSTAMT; view.next(); } lblTotalCount.Text = string.Format("總件數:{0}", view.calculateCount()); lblTotalAmt.Text = string.Format("總金額:{0}", totalamount); }
void BuildRows() { DataGridViewRowCollection rows = ItemIdDataGrid.Rows; foreach (CollarItemId cid in NC.App.DB.CollarItemIds.GetList()) { string[] a = ToSimpleValueArray(cid); int i = rows.Add(a); rows[i].Cells[1].Tag = cid.length.v; rows[i].Cells[2].Tag = cid.length.err; rows[i].Cells[3].Tag = cid.total_u235.v; rows[i].Cells[4].Tag = cid.total_u235.err; rows[i].Cells[5].Tag = cid.total_u238.v; rows[i].Cells[6].Tag = cid.total_u238.err; rows[i].Cells[7].Tag = cid.total_rods; rows[i].Cells[8].Tag = cid.total_poison_rods; rows[i].Cells[9].Tag = cid.poison_percent.v; rows[i].Cells[10].Tag = cid.poison_percent.err; } // Generate a copy of the ItemId string in case the user changes it so we can tell what is a new row and what is a name change for (int i = 0; i < rows.Count; i++) { DataGridViewRow row = rows[i]; if (string.IsNullOrEmpty((string)((DataGridViewTextBoxCell)row.Cells["Item"]).Value)) { continue; } else { // Set the row's Tag member to a copy of the ItemId string row.Tag = string.Copy((string)((DataGridViewTextBoxCell)row.Cells["Item"]).Value); } } }