void FrmCarEntry_Load(object sender, EventArgs e) { txtPacking.Text = PackingNo; tagDP.ServiceName = "iplature"; tagDP.AutoRegist = true; TagValues.Clear(); TagValues.Add("EV_NEW_PARKING_CARARRIVE", null); tagDP.Attach(TagValues); this.Text = string.Format("{0}到位", carType); if (carType == "框架车") { txtDirection.Enabled = false; txtDirection.Text = "东"; txtDirection.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; cmbCarType.Enabled = false; //cmbCarType.SelectedText = "普通框架"; cmbCarType.Text = "普通框架"; cmbCarType.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; } else if (carType == "社会车") { txtDirection.Text = ""; //cmbCarType.SelectedText = "一般社会车辆"; cmbCarType.Text = "一般社会车辆"; cmbCarType.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; } else { cmbCarType.Text = "车辆出库车到位"; cmbCarType.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; } BindCarDrection();//绑定方向 BindCarType(cmbCarType); //txtDirection.Text = ""; if (PackingNo.Contains("Z3")) { labTips.Text = "朝4-1门为南,朝4-4门为北"; } else if (PackingNo.Contains("Z5")) { labTips.Text = "朝7-1门为东,朝7-9门为西"; } }
private void BindCarDrection() { DataTable dt = new DataTable(); dt.Columns.Add("TypeValue"); dt.Columns.Add("TypeName"); DataRow dr = dt.NewRow(); if (PackingNo.Contains("Z3")) { dr = dt.NewRow(); dr["TypeValue"] = "S"; dr["TypeName"] = "南"; dt.Rows.Add(dr); dr = dt.NewRow(); dr["TypeValue"] = "N"; dr["TypeName"] = "北"; dt.Rows.Add(dr); } else { dr = dt.NewRow(); dr["TypeValue"] = "E"; dr["TypeName"] = "东"; dt.Rows.Add(dr); dr = dt.NewRow(); dr["TypeValue"] = "W"; dr["TypeName"] = "西"; dt.Rows.Add(dr); } //绑定列表下拉框数据 this.txtDirection.DisplayMember = "TypeName"; this.txtDirection.ValueMember = "TypeValue"; this.txtDirection.DataSource = dt; }