我赋值给单选框控件的文本值被系统清空掉了,没法保存下来。
用户维护有两个品牌,在修改维护其中一个品牌,另外一个就无法维护了,因为这个品牌是数据库中数据加载到控件上的,我想要通过一个lab标签存储这个未选中的单选框的值,再点击修改的时候把这个值赋值给未选中的单选框,显示为未勾选。
if (cebNissan.Checked)
{
dr["Brand"] = this.cebNissan.Text;
labBrand.Text=this.cebLanTu.Text.Trim();
this.cebLanTu.Text = "LanTu";
}
if (cebLanTu.Checked)
{
dr["Brand"] = this.cebLanTu.Text;
labBrand.Text = this.cebNissan.Text.Trim();
this.cebNissan.Text ="NISSAN";
}
验证值:
if (this.cebLanTu.Text!="")
{
this.cebLanTu.Text = drv["Brand"].ToString();
this.cebLanTu.Checked = true;
this.cebNissan.Checked = false;
this.cebNissan.Text = this.labBrand.Text;
}
if (this.cebNissan.Text!="")
{
this.cebNissan.Text = drv["Brand"].ToString();
this.cebNissan.Checked = true;
this.cebLanTu.Checked = false;
this.cebLanTu.Text = this.labBrand.Text;
}
给控件赋值文本,并通过值验证保存的是哪一个值
通过lab标签存储这个未被选中的值,再把这个未选中的单选框文本赋值,然后点击修改的时候加载前验证单选框的文本是否为空。
用户可以维护两个品牌,能修改一个同时也能修改回去,不会存在只能修改一个。
你建个全局变量就行了,搞什么lab标签
你有两个东西要修改,那这两个东西存在哪了呢,总要有个地方存吧
如果你只有一个变量来保存2个东西,那怎么存呢