本文介绍了C#中的下拉列表无法显示.text的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,全部,



我有2个下拉列表



combobox1和combobox2



当我在combobox1中选择一些东西时我想在我的代码中用combobox2显示一个数字。



Hi, all,

I have 2 dropdown list

combobox1 and combobox2

when I will choose something in combobox1 I want to show a number in combobox2 this what I did in my code.

private void cmbCaptureMethod_SelectedIndexChanged(object sender, EventArgs e)
      {
          ComboBox senderComboBox = (ComboBox)sender;

          if (senderComboBox.SelectedIndex > 0)
          {
              if (this.Institution_number == "00000004" && this.Card_type == "Visa Card")
              {
                  string capturemethodtoeci = cmbCaptureMethod.SelectedValue.ToString();

                  switch (capturemethodtoeci)
                  {
                      case "030":
                          this.eciindicator = 1;
                          break;
                      case "045":
                          this.eciindicator = 2;
                          break;
                      case "050":
                          this.eciindicator = 5;
                          break;
                      case "051":
                          this.eciindicator = 6;
                          break;
                      case "053":
                          this.eciindicator = 8;
                          break;
                      case "054":
                          this.eciindicator = 7;
                          break;
                      case "121":
                          this.eciindicator = 0;
                          break;
                      default:
                          break;
                  }
                  cmbEciIndicator.Text = this.eciindicator.ToString();
              }
          }
      }





我尝试过:



当它不是下拉列表时一切正常但现在eciindicator没有显示。有谁可以帮助我吗?



我尝试了几种方法,例如:



cmbeciindicator.items.insertat(0,this.eciindicator .toString());

cmbeciindicator.text = this.eciindicator.toString();



What I have tried:

when it was not dropdownlist everything works perfectly but now the eciindicator is not showing. Can someone help me please?

I have tried several methods like :

cmbeciindicator.items.insertat(0,this.eciindicator.toString());
cmbeciindicator.text = this.eciindicator.toString();

推荐答案


这篇关于C#中的下拉列表无法显示.text的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-14 19:56