if programmatically the
ComboBox control of a data-bound member for the
Text property set, expected as the value in the
ComboBox of the text box portion typed is displayed. however,
Text property the and the
SelectedIndex property incorrectly return value in the value in the text box typed returning instead of the list box selected was that the last item of the.
when type in the
ComboBox runtime at,
Text property returns the typed value, and
SelectedIndex returns a value
-1 of.
先頭へ戻る
この問題を解決するには、
コンボ ボックス (ComboBox) コントロール 、次の例のようにのデータ バインド メンバの
Text プロパティを設定する前に、
SelectedIndex プロパティを
-1 に設定します。
Visual Basic .NET
ComboBox1.SelectedIndex = -1
ComboBox1.Text = "My Text"
Visual C# .NET
ComboBox1.SelectedIndex = -1;
ComboBox1.Text = "My Text";
NOTE : Do to the
ComboBox of a data-bound member select the
Text property use not. must want to show, that the list in the item locate and the index of the item to set the
SelectedIndex then. to set the
Text property have not do.
for example, a list to the
DisplayMember property and the
ComboBox of the
ValueMember property bind if that contains the numbers through 10, 1 and want to the text box in the number
5 display and the
SelectedIndex property
5 to set must
5 in the list, selected as show the ComboBox.
先頭へ戻る
Microsoft はこのとして認識していますバグ、Microsoft にこの資料の冒頭に記載した製品です。
先頭へ戻る