示例#1
0
        private void XtraForm1_Load(object sender, EventArgs e)
        {
            comboBoxEdit1.Properties.Items.Clear();
            comboBoxEdit5.Properties.Items.Clear();
            comboBoxEdit8.Properties.Items.Clear();
            ComboxData data51 = new ComboxData
            {
                Text  = "串口通信",
                Value = "1"
            };
            ComboxData data52 = new ComboxData
            {
                Text  = "TCP通信",
                Value = "0"
            };

            comboBoxEdit5.Properties.Items.Add(data51);
            comboBoxEdit5.Properties.Items.Add(data52);
            ComboxData data81 = new ComboxData
            {
                Text  = "开启",
                Value = "0"
            };
            ComboxData data82 = new ComboxData
            {
                Text  = "关闭",
                Value = "1"
            };

            comboBoxEdit8.Properties.Items.Add(data81);
            comboBoxEdit8.Properties.Items.Add(data82);
            string    sql = "select * from project";
            DataTable dt  = common.MySqlHelper.GetDataSet(sql, null).Tables[0];

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                ComboxData data = new ComboxData
                {
                    Text  = dt.Rows[i].ItemArray[1].ToString(),
                    Value = dt.Rows[i].ItemArray[0].ToString()
                };
                comboBoxEdit1.Properties.Items.Add(data);
            }
            if (comboBoxEdit1.Properties.Items.Count > 0)
            {
                comboBoxEdit1.SelectedItem = comboBoxEdit1.Properties.Items[0];
            }
        }
示例#2
0
文件: LineForm.cs 项目: bug8975/RXD
        private void LineForm_Load(object sender, EventArgs e)
        {
            comboBoxEdit1.Properties.Items.Clear();
            string    sql = "select * from project";
            DataTable dt  = common.MySqlHelper.GetDataSet(sql, null).Tables[0];

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                ComboxData data = new ComboxData
                {
                    Text  = dt.Rows[i].ItemArray[1].ToString(),
                    Value = dt.Rows[i].ItemArray[0].ToString()
                };
                comboBoxEdit1.Properties.Items.Add(data);
            }
            if (comboBoxEdit1.Properties.Items.Count > 0)
            {
                comboBoxEdit1.SelectedItem = comboBoxEdit1.Properties.Items[0];
            }
        }
示例#3
0
        private void comboBoxEdit1_SelectedIndexChanged(object sender, EventArgs e)
        {
            comboBoxEdit2.Properties.Items.Clear();
            MySqlParameter project_id = new MySqlParameter("@project_id", MySqlDbType.Int32)
            {
                Value = (comboBoxEdit1.SelectedItem as ComboxData).Value
            };
            string    sql = "select * from monitorline where project_id = ?";
            DataTable dt  = common.MySqlHelper.GetDataSet(sql, project_id).Tables[0];

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                ComboxData data = new ComboxData
                {
                    Text  = dt.Rows[i].ItemArray[1].ToString(),
                    Value = dt.Rows[i].ItemArray[0].ToString()
                };
                comboBoxEdit2.Properties.Items.Add(data);
            }
            if (comboBoxEdit2.Properties.Items.Count > 0)
            {
                comboBoxEdit2.SelectedItem = comboBoxEdit2.Properties.Items[0];
            }
        }