C# 该值违反了该列的 MaxLength 限制,即带有 cabbr c(2) cstatename c(20) [关闭]

问题描述 投票:0回答:0
    // here is the code  in form1.designer.cs
    // comboBox1
    // 
    this.comboBox1.DataBindings.Add(new System.Windows.Forms.Binding 
    "Text", this.pOLICYBindingSource, "CSTATE", true));
    this.comboBox1.DataSource = this.wexfordTestDataSet.ORISTATES;
    this.comboBox1.DisplayMember = "CSTATENAME";
    this.comboBox1.FormattingEnabled = true;
    this.comboBox1.Location = new System.Drawing.Point(592, 518);
    this.comboBox1.Margin = new System.Windows.Forms.Padding(4, 5, 4, 
    5);
    this.comboBox1.MaxLength = 20;
    this.comboBox1.Name = "comboBox1";
    this.comboBox1.Size = new System.Drawing.Size(200, 28);
    this.comboBox1.TabIndex = 26;
    this.comboBox1.ValueMember = "CABBR";
    this.comboBox1.SelectedValueChanged += new System.EventHandler 
    (this.comboBox1_SelectedValueChanged);

这将不允许值与显示不同 我已经附上了错误图片 |CABBR ISTATE CSTATENAME | :--- | :---: | ------:| ,0,请选择 AL,1,阿拉巴马州
AK,2,阿拉斯加
AR,3,阿肯色州
AZ,4,亚利桑那
CA,5,加利福尼亚州
CO,6,科罗拉多
CT,7,康涅狄格
DE,8,特拉华州
DC,9,哥伦比亚特区 FL,10,佛罗里达
GA,11,格鲁吉亚
GU,12,关岛
嗨,13 岁,夏威夷

c# winforms combobox tableadapter
© www.soinside.com 2019 - 2024. All rights reserved.