public void setControl(String sfId) { tho = lc.selectThoobyPk(sfId); txtThooId.Text = tho.Id; txtThooCode.Text = tho.Code; txtThooName.Text = tho.Name; txtThooRemark.Text = tho.Remark; txtColor.Text = tho.Color; try { txtColor.BackColor = ColorTranslator.FromHtml(lc.getThooBackColor(tho.Color)); } catch (Exception ex) { } if (tho.Limit1.Equals("")) { txtLimit.Text = "1,000,000"; } else { txtLimit.Text = String.Format("{0:#,###,###.00}", Double.Parse(tho.Limit1)); } if (tho.Active.Equals("1") || sfId.Equals("")) { chkActive.Checked = true; ChkUnActive.Checked = false; btnUnActive.Visible = false; } else { chkActive.Checked = false; ChkUnActive.Checked = true; } }
private void setDataGrdThoo() { DataTable dt = new DataTable(); dt = lc.selectThooAll(); dgvThooTranfer.RowCount = dt.Rows.Count; if (dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { try { dgvThooTranfer[colTRow, i].Value = (i + 1); dgvThooTranfer[colTName, i].Value = dt.Rows[i][lc.thodb.tho.Name].ToString(); dgvThooTranfer[colTLimit, i].Value = String.Format("{0:#,###,###.00}", dt.Rows[i][lc.thodb.tho.Limit1]); dgvThooTranfer[colTAmt, i].Value = ""; dgvThooTranfer[colTId, i].Value = dt.Rows[i][lc.thodb.tho.Id].ToString(); dgvThooTranfer.Rows[i].DefaultCellStyle.BackColor = ColorTranslator.FromHtml(lc.getThooBackColor(dt.Rows[i][lc.thodb.tho.Color].ToString())); } catch (Exception ex) { } //if ((i % 2) != 0) //{ // dgvThoo.Rows[i].DefaultCellStyle.BackColor = Color.LightSalmon; //} } } }
public void setControl() { DataTable dt = new DataTable(); dt = lc.selectThooAll(); dgvView.ColumnCount = colCnt; dgvView.RowCount = dt.Rows.Count + 1; dgvView.SelectionMode = DataGridViewSelectionMode.FullRowSelect; dgvView.MultiSelect = false; dgvView.Columns[colRow].Width = 50; dgvView.Columns[colName].Width = 150; dgvView.Columns[colRemark].Width = 120; dgvView.Columns[colId].Width = 80; dgvView.Columns[colRow].HeaderText = "ลำดับ"; dgvView.Columns[colCode].HeaderText = "code"; dgvView.Columns[colName].HeaderText = "ชื่อ"; dgvView.Columns[colRemark].HeaderText = "หมายเหตุ"; dgvView.Columns[colLimit].HeaderText = "อั้น"; dgvView.Columns[colId].HeaderText = "id"; dgvView.Columns[colId].HeaderText = "id"; Font font = Font; dgvView.Font = font; dgvView.Columns[colId].Visible = false; if (dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { try { dgvView[colRow, i].Value = (i + 1); dgvView[colCode, i].Value = dt.Rows[i][lc.thodb.tho.Code].ToString(); dgvView[colName, i].Value = dt.Rows[i][lc.thodb.tho.Name].ToString(); dgvView[colRemark, i].Value = dt.Rows[i][lc.thodb.tho.Remark].ToString(); dgvView[colId, i].Value = dt.Rows[i][lc.thodb.tho.Id].ToString(); dgvView[colLimit, i].Value = String.Format("{0:#,###,###.00}", dt.Rows[i][lc.thodb.tho.Limit1]); dgvView.Rows[i].DefaultCellStyle.BackColor = ColorTranslator.FromHtml(lc.getThooBackColor(dt.Rows[i][lc.thodb.tho.Color].ToString())); } catch (Exception ex) { } } dgvView.Rows[dgvView.RowCount - 1].Selected = true; } dgvView.ReadOnly = true; }