private void ADAM_AutoIO_LtoH_Latch_Load(object sender, EventArgs e) { #region -- Item -- chkbox = new CheckBox[num_item]; setTxtbox = new TextBox[num_item]; getTxtbox = new TextBox[num_item]; apaxTxtbox = new TextBox[num_item]; modbTxtbox = new TextBox[num_item]; resLabel = new Label[num_item]; chkbox.Initialize(); setTxtbox.Initialize(); getTxtbox.Initialize(); apaxTxtbox.Initialize(); modbTxtbox.Initialize(); resLabel.Initialize(); var text_style = new FontFamily("Times New Roman"); for (int i = 0; i < num_item; i++) { chkbox[i] = new CheckBox(); chkbox[i].Name = "StpChkIdx" + (i + 1).ToString(); chkbox[i].Location = new Point(10, 83 + 35 * (i + 1)); chkbox[i].Text = ""; chkbox[i].Parent = this; chkbox[i].CheckedChanged += new EventHandler(SubChkBoxChanged); setTxtbox[i] = new TextBox(); setTxtbox[i].Size = new Size(60, 25); setTxtbox[i].Location = new Point(174, 83 + 35 * (i + 1)); setTxtbox[i].Font = new Font(text_style, 12, FontStyle.Regular); setTxtbox[i].TextAlign = HorizontalAlignment.Center; setTxtbox[i].Parent = this; getTxtbox[i] = new TextBox(); getTxtbox[i].Size = new Size(60, 25); getTxtbox[i].Location = new Point(240, 83 + 35 * (i + 1)); getTxtbox[i].Font = new Font(text_style, 12, FontStyle.Regular); getTxtbox[i].TextAlign = HorizontalAlignment.Center; getTxtbox[i].Parent = this; apaxTxtbox[i] = new TextBox(); apaxTxtbox[i].Size = new Size(60, 25); apaxTxtbox[i].Location = new Point(306, 83 + 35 * (i + 1)); apaxTxtbox[i].Font = new Font(text_style, 12, FontStyle.Regular); apaxTxtbox[i].TextAlign = HorizontalAlignment.Center; apaxTxtbox[i].Parent = this; modbTxtbox[i] = new TextBox(); modbTxtbox[i].Size = new Size(60, 25); modbTxtbox[i].Location = new Point(372, 83 + 35 * (i + 1)); modbTxtbox[i].Font = new Font(text_style, 12, FontStyle.Regular); modbTxtbox[i].TextAlign = HorizontalAlignment.Center; modbTxtbox[i].Parent = this; resLabel[i] = new Label(); resLabel[i].Size = new Size(60, 25); resLabel[i].Location = new Point(438, 83 + 35 * (i + 1)); resLabel[i].Font = new Font(text_style, 12, FontStyle.Regular); resLabel[i].Text = ""; resLabel[i].Parent = this; } for (int i = 0; i < num_item; i++) { chkbox[i].Checked = true; } // dataGridView1.ColumnHeadersVisible = true; DataGridViewTextBoxColumn newCol = new DataGridViewTextBoxColumn(); // add a column to the grid newCol.HeaderText = "Time"; newCol.Name = "clmTs"; newCol.Visible = true; newCol.Width = 20; dataGridView1.Columns.Add(newCol); // newCol = new DataGridViewTextBoxColumn(); newCol.HeaderText = "Ch"; newCol.Name = "clmStp"; newCol.Visible = true; newCol.Width = 30; dataGridView1.Columns.Add(newCol); // newCol = new DataGridViewTextBoxColumn(); newCol.HeaderText = "Step"; newCol.Name = "clmIns"; newCol.Visible = true; newCol.Width = 100; dataGridView1.Columns.Add(newCol); // newCol = new DataGridViewTextBoxColumn(); newCol.HeaderText = "Result"; newCol.Name = "clmDes"; newCol.Visible = true; newCol.Width = 50; dataGridView1.Columns.Add(newCol); // newCol = new DataGridViewTextBoxColumn(); newCol.HeaderText = "Rowdata"; newCol.Name = "clmRes"; newCol.Visible = true; newCol.Width = 200; dataGridView1.Columns.Add(newCol); for (int i = 0; i < dataGridView1.Columns.Count - 1; i++) { dataGridView1.Columns[i].SortMode = DataGridViewColumnSortMode.Automatic; } dataGridView1.Rows.Clear(); try { m_DataGridViewCtrlAddDataRow = new DataGridViewCtrlAddDataRow(DataGridViewCtrlAddNewRow); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } #endregion ADAM6KReqService = new ADAM6KReqService(); APAX5070Service = new ModbusTCPService(); ADAMmds = new ModbusTCPService(); //debug //ADAMConnection(); }