【问题标题】:Autocomplete ComboBox only displays the first letter when I try and type in it自动完成组合框仅在我尝试输入时显示第一个字母
【发布时间】:2017-02-24 17:47:11
【问题描述】:

在使用轮询 Google Place API 的 WinForms c# 程序时遇到问题。

出于某种原因,我的组合框只显示我输入的第一个字母。一旦我输入一个字母,它就会删除旧字母并用新字母替换它。

请帮助我。这是我正在使用的代码。

var request = new PlacesAutoCompleteRequest
{
    Key = "Not Telling",
    Input = comboBoxStreetAddress.Text,
    Sensor = true
};

var response = GooglePlaces.AutoComplete.Query(request);
var results = response.Predictions.ToArray();

AutoCompleteStringCollection array = new AutoCompleteStringCollection();

for (int x = 0; x < results.Count(); x++)
{
    array.Add(results[x].Description);
}

comboBoxStreetAddress.AutoCompleteCustomSource = array;

【问题讨论】:

  • 这里没有足够的代码来帮助您诊断问题。你的组合框还有其他方法吗?

标签: c# winforms combobox autocomplete


【解决方案1】:

看来您的问题可能出在其他地方。每次键入字母时,听起来您的组合框都会重新获得焦点。

【讨论】:

    猜你喜欢
    • 2013-06-19
    • 2017-09-22
    • 2012-10-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多