1

I have a very simple question that i can't seem to find the answer, i have looked up and down in google, msdn with no luck...

it's really simple yet i can't seem to wrap my mind around it.

here goes:

If i'm using simple Drop down style combo box(the one that looks like a listbox with textbox attached on top of the cbobx control) when i want to update one of the value in it, once i start typing in the textbox the selection inside the combo box is gone. Thus i can't update the value inside the combo box.

i know i can use a regular text box to do this, but i'd really like to make this work or i would really loose sleep over this.

Thanks in advance for all your help.

Ray

4

1 回答 1

1

在组合框中编辑选择似乎不是很直观,但以下应该可以解决问题:

 Private cbindex As Integer

 Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
    cbindex = ComboBox1.SelectedIndex
 End Sub

 Private Sub ComboBox1_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles ComboBox1.LostFocus
    ComboBox1.Items(cbindex) = ComboBox1.Text
 End Sub
于 2012-11-24T07:27:06.020 回答