void loadComboStep(string productCode) { DataTable dt = TextUtils.LoadDataFromSP("spGetProductStep_ByProductCode", "A" , new string[1] { "@ProductCode" } , new object[1] { productCode }); DataRow dr = dt.NewRow(); dr["ID"] = 0; dr["ProductStepCode"] = ""; dt.Rows.InsertAt(dr, 0); cboWorkingStep.DataSource = dt; cboWorkingStep.DisplayMember = "ProductStepCode"; cboWorkingStep.ValueMember = "ID"; if (dt.Rows.Count > 1) { for (int i = 1; i < dt.Rows.Count; i++) { if (dt.Rows[i]["ProductStepCode"].ToString().Trim().Equals("CDXK")) { cboWorkingStep.SelectedIndex = i; return; } } } }
private void LoadInfoSearch(int type = 0) { //string[] paraName = new string[2]; //object[] paraValue = new object[2]; if (type == 0) { _catID = TextUtils.ToInt(treeData.FocusedNode.GetValue(colIDTree)); } else { _catID = 0; } //paraName[0] = "@GroupID"; paraValue[0] = _catID; //paraName[1] = "@TextFilter"; paraValue[1] = txtName.Text.Trim(); DataTable arr = TextUtils.LoadDataFromSP("spGetStockCD" , "A" , new string[] { "@StockID", "@TextFilter" } , new object[] { _catID, txtName.Text.Trim() } ); grdData.DataSource = arr; }
/// <summary> /// LoadDataInTextBox /// </summary> private void LoadData() { if (!string.IsNullOrEmpty(txtOrderNo.Text.Trim())) { try { DataTable dt = TextUtils.LoadDataFromSP("spGetGearInfo_ByOrderCode", "A" , new string[1] { "@OrderCode" } , new object[1] { txtOrderNo.Text.Trim() }); Qty = TextUtils.ToInt(dt.Rows[0]["Qty"]); txtQty.Text = Qty.ToString("n0"); txtLAP.Text = TextUtils.ToString(dt.Rows[0]["ProductCode"]); txtSlitMax.Text = TextUtils.ToDecimal(dt.Rows[0]["SlitMax"]).ToString("n3"); txtSlitMin.Text = TextUtils.ToDecimal(dt.Rows[0]["SlitMin"]).ToString("n3"); txtVibrateMaxT.Text = TextUtils.ToDecimal(dt.Rows[0]["VibrateMax"]).ToString("n3"); txtVibrateMaxN.Text = txtVibrateMaxT.Text; txtVibrateMinT.Text = TextUtils.ToDecimal(dt.Rows[0]["VibrateMin"]).ToString("n3"); txtVibrateMinN.Text = txtVibrateMinT.Text; SlitMax = Decimal.Parse(txtSlitMax.Text.ToString()); } catch (Exception) { MessageBox.Show("OrderNo is not correct"); } } }
void loadData() { removeColumn(); DateTime from = new DateTime(dtpFromDate.Value.Year, dtpFromDate.Value.Month, dtpFromDate.Value.Day, 0, 0, 0); DateTime to = new DateTime(dtpEndDate.Value.Year, dtpEndDate.Value.Month, dtpEndDate.Value.Day, 23, 59, 59); if (txtFromOrder.Text.Trim() != "" && txtToOrder.Text.Trim() != "") { string sql = @"SELECT TOP 1 DateLR FROM dbo.ProductCheckHistoryDetail WHERE OrderCode LIKE '%{0}%' ORDER BY DateLR"; DateTime?date1 = TextUtils.ToDate2(TextUtils.ExcuteScalar(string.Format(sql, txtFromOrder.Text.Trim()))); DateTime?date2 = TextUtils.ToDate2(TextUtils.ExcuteScalar(string.Format(sql, txtToOrder.Text.Trim()))); if (date1.HasValue && date2.HasValue) { if (date2.Value >= date1.Value) { from = new DateTime(date1.Value.Year, date1.Value.Month, date1.Value.Day, 0, 0, 0); to = new DateTime(date2.Value.Year, date2.Value.Month, date2.Value.Day, 0, 0, 0); } else { to = new DateTime(date1.Value.Year, date1.Value.Month, date1.Value.Day, 0, 0, 0); from = new DateTime(date2.Value.Year, date2.Value.Month, date2.Value.Day, 0, 0, 0); } } } List <string> listColumnText = new List <string>(); if (txtFindText.Text.Trim() == "") { return; } string[] arr = txtFindText.Text.Trim().Split(';'); for (int i = 0; i < arr.Length; i++) { listColumnText.Add(string.Format("[{0}]", arr[i])); grvData.Columns[i + 1].VisibleIndex = i + 1; grvData.Columns[i + 1].Caption = arr[i]; grvData.Columns[i + 1].FieldName = arr[i]; grvData.Columns[i + 1].Width = 200; } DataTable dt = TextUtils.LoadDataFromSP("spThongKePhanTichData", "A" , new string[] { "@From", "@To", "@FistColumnText" } , new object[] { from, to, string.Join(",", listColumnText) }); //DataColumn c = new DataColumn(); //c.Caption = "STT"; //c.ColumnName = "STT"; //c.DataType = typeof(int); //c.AutoIncrement = true; //c.AutoIncrementSeed = 1; //c.AutoIncrementStep = 1; //c.AllowDBNull = false; ////c.Unique = true; //dt.Columns.Add(c); //dt.Columns["STT"].SetOrdinal(0); grdData.DataSource = dt; }
private void LoadData() { // Load Andon có thời gian bắt đầu >= ngày hiện tại để hiển thị lên gridView DataTable data = TextUtils.LoadDataFromSP("spGetAndonByDate", "Andon", new string[] { }, new object[] { }); grdData.DataSource = data; }
private void frmConfig_Load(object sender, EventArgs e) { ArrayList arr = AndonConfigBO.Instance.FindAll(); DataTable data = TextUtils.LoadDataFromSP("spGetConfigPLC", "A", new string[0] { }, new string[0] { }); grvAreaPLC.AutoGenerateColumns = false; if (data.Rows.Count > 0) { grvAreaPLC.DataSource = _bindingSource; _bindingSource.DataSource = data; } if (arr.Count > 0) { AndonConfigModel andonConfig = (AndonConfigModel)arr[0]; numFontValueCD.Value = andonConfig.FontSize1; numFontTitleCD.Value = andonConfig.FontSize2; numFontValuePlan.Value = andonConfig.FontSize3; numFontLabelPlan.Value = andonConfig.FontSize4; numFontTitleAndon.Value = andonConfig.FontSize5; numLabelTakt.Value = andonConfig.FontSize6; numValueTakt.Value = andonConfig.FontSize7; txtPort.Text = TextUtils.ToString(andonConfig.SocketPort); txtTakt.Text = TextUtils.ToString(andonConfig.Takt); txtTcpIp.Text = TextUtils.ToString(andonConfig.TcpIp); } }
void loadData() { DataTable dt = TextUtils.LoadDataFromSP("spGetHistoryCheckOrderDataDetail", "A" , new string[] { "orderCode" } , new object[] { _OrderCode }); int count = dt.Columns.Count; if (count > 9) { string RealValue1 = Lib.ToString(dt.Columns[9]); colRealValue1.FieldName = RealValue1; colRealValue1.Caption = RealValue1; } else { colRealValue1.Visible = false; } if (count > 10) { string realvalue2 = Lib.ToString(dt.Columns[10]); colRealValue2.FieldName = realvalue2; colRealValue2.Caption = realvalue2; } else { colRealValue2.Visible = false; } if (count > 11) { string realvalue3 = Lib.ToString(dt.Columns[11]); colRealValue3.FieldName = realvalue3; colRealValue3.Caption = realvalue3; } else { colRealValue3.Visible = false; } if (count > 12) { string realvalue4 = Lib.ToString(dt.Columns[12]); colRealValue4.FieldName = realvalue4; colRealValue4.Caption = realvalue4; } else { colRealValue4.Visible = false; } if (count > 13) { string realvalue5 = Lib.ToString(dt.Columns[13]); colRealValue5.FieldName = realvalue5; colRealValue5.Caption = realvalue5; } else { colRealValue5.Visible = false; } grdData.DataSource = dt; }
void loadData() { DataTable dt = TextUtils.LoadDataFromSP("spGetHistoryCheckDataDetail", "A" , new string[] { "QRCode" } , new object[] { QRCode }); grdData.DataSource = dt; }
void loadData() { DataTable dt = TextUtils.LoadDataFromSP("spFindDataCD1", "A" , new string[] { "@TextFind" } , new object[] { txtFindText.Text.Trim() }); grdData.DataSource = dt; }
private void LoadGearWorking() { string HYP = TextUtils.ToString(grvData.GetFocusedRowCellValue(colHYP)); DataTable dt = new DataTable(); dt = TextUtils.LoadDataFromSP("spGetGearWorking_ByHypCode", "A" , new string[] { "@HYP" } , new object[] { HYP }); grdDetail.DataSource = dt; }
private void LoadInfoSearch() { DateTime from = new DateTime(dtpFromDate.Value.Year, dtpFromDate.Value.Month, dtpFromDate.Value.Day, 0, 0, 0); DateTime to = new DateTime(dtpEndDate.Value.Year, dtpEndDate.Value.Month, dtpEndDate.Value.Day, 23, 59, 59); DataTable dt = TextUtils.LoadDataFromSP("spGetPlanDataTestler", "A" , new string[] { "@FromDate", "@EndDate", "@TextFilter" } , new object[] { from, to, txtName.Text.Trim() }); grdData.DataSource = dt; }
private void loadCombo() { object takt = TextUtils.ExcuteScalar("Select Takt from AndonConfig"); txtTakt.Text = TextUtils.ToString(takt); DataTable data = TextUtils.LoadDataFromSP("spGetShift", "Shift", new string[] { }, new object[] { }); cbxShiftType.DataSource = data; cbxShiftType.DisplayMember = "hourTime"; cbxShiftType.ValueMember = "ID"; }
void loadData() { DateTime from = new DateTime(dtpFromDate.Value.Year, dtpFromDate.Value.Month, dtpFromDate.Value.Day, 0, 0, 0); DateTime to = new DateTime(dtpEndDate.Value.Year, dtpEndDate.Value.Month, dtpEndDate.Value.Day, 23, 59, 59); DataTable dt = TextUtils.LoadDataFromSP("spGetHistoryCheckData", "A" , new string[] { "@FromDate", "@EndDate", "@TextFind" } , new object[] { from, to, txtFindText.Text.Trim() }); grdData.DataSource = dt; }
void loadWorkingStep(string productCode) { DataTable dt = TextUtils.LoadDataFromSP("spGetWorkingStep_ByProduct", "A", new string[1] { "@ProductCode" }, new object[1] { productCode }); cboWorkingStep.DataSource = dt; cboWorkingStep.DisplayMember = "WorkingStepCode"; cboWorkingStep.ValueMember = "ID"; }
void loadLocation() { int stepID = TextUtils.ToInt(grvData.GetFocusedRowCellValue(colID)); DataTable dt = new DataTable(); //dt = TextUtils.Select(string.Format("SELECT * FROM dbo.ProductWorking WHERE ProductStepID = {0} ORDER BY SortOrder", stepID)); dt = TextUtils.LoadDataFromSP("spGetLocation", "A" , new string[] { "@CDID" } , new object[] { stepID }); grdDetail.DataSource = dt; }
void loadWorking() { int stepID = TextUtils.ToInt(grvData.GetFocusedRowCellValue(colStepID)); if (chkAll.Checked) { stepID = 0; } DataTable dt = new DataTable(); //dt = TextUtils.Select(string.Format("SELECT * FROM dbo.ProductWorking WHERE ProductStepID = {0} ORDER BY SortOrder", stepID)); dt = TextUtils.LoadDataFromSP("spGetProductWorking_ByProductID", "A" , new string[] { "@ProductID", "@ProductStepID" } , new object[] { this.ProductID, stepID }); grdDetail.DataSource = dt; }
/// <summary> /// load dữ liệu order khi nhập order và sau khi cất /// nvthao /// 25.12.2019 /// </summary> private void LoadData() { try { DataTable dt = TextUtils.LoadDataFromSP("spGetGearInfo_ByOrderCode", "A" , new string[1] { "@OrderCode" } , new object[1] { txtOrderNo.Text.Trim() }); if (dt.Rows.Count > 0) { _qty = TextUtils.ToInt(dt.Rows[0]["Qty"]); txtQty.Text = _qty.ToString("n0"); txtLAP.Text = TextUtils.ToString(dt.Rows[0]["Lap"]); txtSlitMax.Text = TextUtils.ToDecimal(dt.Rows[0]["SlitMax"]).ToString("n3"); txtSlitMin.Text = TextUtils.ToDecimal(dt.Rows[0]["SlitMin"]).ToString("n3"); txtDoDaoJigLapMin.Text = TextUtils.ToDecimal(dt.Rows[0]["DoDaoJigLapMin"]).ToString("n3"); txtDoDaoJigLapMax.Text = TextUtils.ToDecimal(dt.Rows[0]["DoDaoJigLapMax"]).ToString("n3"); txtVibrateMaxN.Text = txtVibrateMaxT.Text = TextUtils.ToDecimal(dt.Rows[0]["VibrateMax"]).ToString("n3"); txtVibrateMinN.Text = txtVibrateMinT.Text = TextUtils.ToDecimal(dt.Rows[0]["VibrateMin"]).ToString("n3"); AddNewRowInDataTable(); } else { txtDoDaoJigLapMax.Text = txtDoDaoJigLapMin.Text = txtSlitMin.Text = txtVibrateMinN.Text = txtVibrateMinT.Text = txtSlitMax.Text = txtVibrateMaxN.Text = txtVibrateMaxT.Text = 0.ToString("n3"); txtQty.Text = "0"; txtLAP.Text = ""; dteNgayGiaCong.Value = DateTime.Now; grvData.DataSource = null; } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
static public bool Log(string U, string P, string code) { try { DataTable dt = TextUtils.LoadDataFromSP("getAuthenticationByIdGroupUser", "A", new string[] { "@username", "@password", "@code" }, new object[] { U, Utils.MD5.EncryptPassword(P), code }); if ((dt != null) && (dt.Rows.Count > 0)) { return(true); } else { return(false); } } catch (Exception ex) { return(false); } }
void LoadDepartment() { if (cbShowAll.Checked) { showAll = true; } else { showAll = false; } int id = TextUtils.ToInt(gvArea.GetFocusedRowCellValue(colIDAr)); if (id == 0) { return; } DataTable arr = TextUtils.LoadDataFromSP("spGetDepartmentListWithFilter", "a", new string[] { "@keyword", "@areaID", "@showAll" }, new object[] { txbSearch.Text.Trim(), id, showAll }); dtgvDepartment.DataSource = arr; }
void LoadMachine() { if (cbShowAll.Checked) { showAll = true; } else { showAll = false; } int id = TextUtils.ToInt(gvStage.GetFocusedRowCellValue(colIDStage)); if (id == 0) { return; } DataTable arr = TextUtils.LoadDataFromSP("spGetMachineListWithFilter", "a", new string[] { "@keyword", "@stageID", "@showAll" }, new object[] { txbSearch.Text.Trim(), id, showAll }); dtgvMachine.DataSource = arr; }
void LoadInfoSearch() { DataTable dt = new DataTable(); dtpFrom.Value = dtpFrom.Value.Date.AddHours(0).AddMinutes(00).AddSeconds(00); dtpTo.Value = dtpTo.Value.Date.AddHours(23).AddMinutes(59).AddSeconds(59); dt = TextUtils.LoadDataFromSP( "spGetProductionPlanFindDate" , "A" , new string[] { "@DateStart", "@DateEnd ", "@TextFilter", "@IsShow", "@UnFinished" } , new object[] { dtpFrom.Value.ToString("yyyy/MM/dd HH:mm:ss") , dtpTo.Value.ToString("yyyy/MM/dd HH:mm:ss") , txtAssyOrderId.Text.Trim() , chkIsShow.Checked , chkUnFinished.Checked } ); grdData.DataSource = dt; }
void LoadDataToChartTime(string knifeCode) { DataTable dt = TextUtils.LoadDataFromSP("spGetChartProductHistoryData", "A", new string[] { "@knifeCode" }, new object[] { knifeCode }); DataTable dt1 = TextUtils.LoadDataFromSP("spGetChartProductTotalHistory", "A", new string[] { }, new object[] { }); DataTable dt2 = new DataTable(); chartControl1.Series[0].DataSource = dt; chartControl1.Series[0].ArgumentScaleType = ScaleType.Auto; chartControl1.Series[0].ArgumentDataMember = "CDay"; chartControl1.Series[0].ValueScaleType = ScaleType.Numerical; chartControl1.Series[0].ValueDataMembers.AddRange(new string[] { "Quantity" }); chartControl1.Series[2].DataSource = dt2; chartControl1.Series[1].DataSource = dt1; chartControl1.Series[1].ArgumentScaleType = ScaleType.Auto; chartControl1.Series[1].ArgumentDataMember = "CDay"; chartControl1.Series[1].ValueScaleType = ScaleType.Numerical; chartControl1.Series[1].ValueDataMembers.AddRange(new string[] { "Quantity" }); //}); }
void loadComboStep(string productCode) { DataTable dt = TextUtils.LoadDataFromSP("spGetProductStep_ByProductCode", "A" , new string[1] { "@ProductCode" } , new object[1] { productCode }); DataRow dr = dt.NewRow(); dr["ID"] = 0; dr["ProductStepCode"] = ""; dt.Rows.InsertAt(dr, 0); cboWorkingStep.DataSource = dt; cboWorkingStep.DisplayMember = "ProductStepCode"; cboWorkingStep.ValueMember = "ID"; if (_stepIndex > 0 && _stepIndex < dt.Rows.Count) { cboWorkingStep.SelectedIndex = _stepIndex; } }
private void LoadData() { DataTable data = TextUtils.LoadDataFromSP("spGetAndonByDate", "Andon", new string[] { }, new object[] { }); grdData.DataSource = data; }
void sendData(string QRCode, string OrderCode) { try { string date = TextUtils.ToString(DateTime.Now.ToString("dd-MM-yyyy HH:mm:ss")); DataTable dt = TextUtils.LoadDataFromSP("spGetHistoryCheckDataDetail", "A" , new string[] { "QRCode" } , new object[] { QRCode }); grdData.DataSource = dt; string[] arr = QRCode.Split(' '); string[] arrOrder = arr[0].Split('-'); //grdData.Print(); if (grvData.RowCount <= 0) { return; } string filePath = TextUtils.ExportExcelReturnFilePathLocal(grvData, QRCode); if (string.IsNullOrEmpty(filePath)) { return; } Excel.Application app = default(Excel.Application); Excel.Workbook workBoook = default(Excel.Workbook); Excel.Worksheet workSheet = default(Excel.Worksheet); try { app = new Excel.Application(); app.Workbooks.Open(filePath); workBoook = app.Workbooks[1]; workSheet = (Excel.Worksheet)workBoook.Worksheets[1]; app.DisplayAlerts = false; for (int i = 0; i < 5; i++) { ((Excel.Range)workSheet.Rows[1]).Insert(); } workSheet.Cells[1, 1] = "Order No: "; workSheet.Cells[1, 3] = arrOrder[0]; workSheet.Cells[2, 1] = "PID No: "; workSheet.Cells[2, 3] = arr[1]; ProductModel p = (ProductModel)ProductBO.Instance.FindByAttribute("ProductCode", arr[1].Trim())[0]; workSheet.Cells[3, 1] = "Mô Tả: "; workSheet.Cells[3, 3] = p.ProductName; workSheet.Cells[4, 1] = "Ngày lắp: "; workSheet.Cells[4, 3] = "'" + date; } catch (Exception ex) { MessageBox.Show("Lỗi: " + ex.Message); } finally { app.ActiveWorkbook.Save(); app.ActiveWorkbook.PrintOutEx(); app.Workbooks.Close(); app.Quit(); //Process.Start(filePath); } } catch { } }
private bool GenerateByHpy(int qty) { if (_hypCode == "") { MessageBox.Show("HYP không được để trống"); return(false); } DataTable dtGearWorking = TextUtils.LoadDataFromSP("spGetGearWorking_ByHypCode", "A", new string[] { "@HYP" }, new object[] { _hypCode }); Expression exp = new Expression("HYP", _hypCode); ArrayList arr = GearBO.Instance.FindByExpression(exp); // Từ các hạng mục kiểm tra sinh ra các cột _countGearWorking = dtGearWorking.Rows.Count; //Đầu tiên bỏ các dòng hiện tại đang có trên danh sách đi grvData.Rows.Clear(); //Xóa các cột có tag Value List <int> lstColumnTag = new List <int>(); for (int i = 0; i < grvData.Columns.Count; i++) { DataGridViewColumn col = grvData.Columns[i]; if (col.Tag != null && col.Tag.ToString() != "") { lstColumnTag.Add(col.Index); } } for (int i = lstColumnTag.Count - 1; i >= 0; i--) { grvData.Columns.Remove(grvData.Columns[lstColumnTag[i]]); } //add tiếp 4 dòng for (int i = 0; i < 4; i++) { grvData.Rows.Add(); } grvData.Rows[0].Cells[0].Value = "Tiêu chuẩn"; grvData.Rows[1].Cells[0].Value = "MIN"; grvData.Rows[2].Cells[0].Value = "MAX"; grvData.Rows[3].Cells[0].Value = "Tần suất"; if (_countGearWorking == 0 || arr.Count <= 0) { MessageBox.Show("Bạn phải nhập đúng HYP!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } GearModel gear = arr[0] as GearModel; _qtyImage = gear.QtyImage; _qtyAudio = gear.QtyAudio; if (qty <= 5) { _qtyImage += 2; } for (int i = _countGearWorking - 1; i >= 0; i--) { DataGridViewTextBoxColumn col = new DataGridViewTextBoxColumn(); col.HeaderText = TextUtils.ToString(dtGearWorking.Rows[i]["WorkingName"]); //Tên của GearWorking col.Tag = TextUtils.ToString(dtGearWorking.Rows[i]["ID"]) + ";" + TextUtils.ToString(dtGearWorking.Rows[i]["SortOrder"]); //Cái này để lưu lại ID của GearWorking col.DataPropertyName = TextUtils.ToString(dtGearWorking.Rows[i]["SortOrder"]); //cho stt vào col.Width = 70; col.SortMode = DataGridViewColumnSortMode.NotSortable; col.Name = "col" + i; grvData.Columns.Insert(3, col); // Cập nhật thông tin dữ liệu 4 dòng dữ liệu với giá trị tiêu chuẩn tương ứng với mỗi cột hạng mục grvData.Rows[0].Cells[3].Value = TextUtils.ToDecimal(dtGearWorking.Rows[i]["DefaultValue"]); grvData.Rows[1].Cells[3].Value = TextUtils.ToDecimal(dtGearWorking.Rows[i]["MinValue"]); grvData.Rows[2].Cells[3].Value = TextUtils.ToDecimal(dtGearWorking.Rows[i]["MaxValue"]); grvData.Rows[3].Cells[3].Value = TextUtils.ToString(dtGearWorking.Rows[i]["TanSuat"]); grvData.Rows[0].Cells[3].Style.BackColor = _mauCarot; grvData.Rows[1].Cells[3].Style.BackColor = _mauCarot; grvData.Rows[2].Cells[3].Style.BackColor = _mauCarot; grvData.Rows[3].Cells[3].Style.BackColor = _mauTanSuat; } for (int i = _qtyAudio; i >= 1; i--) { DataGridViewTextBoxColumn col = new DataGridViewTextBoxColumn(); col.HeaderText = "Âm thanh " + i; //Tên của GearWorking //col.Tag = TextUtils.ToString(dtGearWorking.Rows[i]["ID"]) + ";" + TextUtils.ToString(dtGearWorking.Rows[i]["SortOrder"]);//Cái này để lưu lại ID của GearWorking //col.DataPropertyName = i.ToString();//cho stt vào col.DataPropertyName = "audio"; col.Tag = i; col.Width = 50; col.SortMode = DataGridViewColumnSortMode.NotSortable; col.Name = "colAudio" + i; col.DefaultCellStyle.ForeColor = Color.Blue; grvData.Columns.Insert(colResult1.Index + 1, col); } for (int i = _qtyImage; i >= 1; i--) { DataGridViewTextBoxColumn col = new DataGridViewTextBoxColumn(); col.HeaderText = "Ảnh " + i; //Tên của GearWorking //col.Tag = TextUtils.ToString(dtGearWorking.Rows[i]["ID"]) + ";" + TextUtils.ToString(dtGearWorking.Rows[i]["SortOrder"]);//Cái này để lưu lại ID của GearWorking col.DataPropertyName = "image"; //cho stt vào col.Tag = i; col.Width = 50; col.SortMode = DataGridViewColumnSortMode.NotSortable; col.Name = "colImage" + i; col.DefaultCellStyle.ForeColor = Color.Blue; grvData.Columns.Insert(colResult1.Index + 1 + _qtyAudio, col); } grvData.Rows[0].ReadOnly = true; grvData.Rows[1].ReadOnly = true; grvData.Rows[2].ReadOnly = true; grvData.Rows[3].ReadOnly = true; return(true); }