当我第一次加载表单时,组合框根据需要运行:
然后当我选择其中一个下拉菜单项时(通过光标或箭头键并输入):
现在,如果我再次尝试编辑组合框中的文本(通过光标或箭头键),则不再显示下拉菜单:
目前我的加载表单方法:
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
'connect to RFDB
Dim connectionString = My.Settings.RFDBConnectionString
Dim connection As New SqlConnection(connectionString)
connection.Open()
'Get Versions Table from RFDB
Dim versions As DataTable
Dim query = "select LocationID, VersionsNum, Description, PlanetExport from Versions inner join VersionsBuild on VersionsBuildID=IDVersionsBuild"
versions = QueryRFDB(query, connectionString)
'Fill ComboBox with possible site versions
Dim source As New AutoCompleteStringCollection()
Dim i As Integer
For i = 0 To versions.Rows.Count - 1
Dim siteVersion As String
siteVersion = versions.Rows(i)(0) & " V" & versions.Rows(i)(1) & " " & versions.Rows(i)(2)
source.Add(siteVersion)
Next i
Me.ComboBox1.AutoCompleteCustomSource = source
Me.ComboBox1.AutoCompleteMode = AutoCompleteMode.Suggest
Me.ComboBox1.AutoCompleteSource = AutoCompleteSource.CustomSource
'Fill ListBox with currently flagged site versions
For i = 0 To versions.Rows.Count - 1
Dim siteVersion As String
siteVersion = versions.Rows(i)(0) & " V" & versions.Rows(i)(1) & " " & versions.Rows(i)(2)
If versions.Rows(i)(3) = True Then Me.ListBox1.Items.Add(siteVersion)
Next i
End Sub
'Returns a data table as the result of the sql query on RFDB
Private Function QueryRFDB(ByVal query As String, ByVal connectionString As String)
Dim adapter As New SqlDataAdapter(query, connectionString)
Dim table As New DataTable
adapter.Fill(table)
Return table
End Function
我认为这可能是我的组合框的设置问题?任何帮助表示赞赏。