简体   繁体   English

自动填充组合框仅在我尝试输入时显示第一个字母

[英]Autocomplete ComboBox only displays the first letter when I try and type in it

Having trouble with WinForms c# program that polls the google places API. 使用WinForms C#程序(轮询Google Places API)时遇到问题。

For some reason, my combobox only displays the first letter of what I type. 由于某种原因,我的组合框仅显示我键入的首字母。 As soon as I type in a letter, it deletes the old letter and replaces it with the new letter. 当我输入字母时,它会删除旧字母并将其替换为新字母。

Please help me. 请帮我。 Here is the code that I am using. 这是我正在使用的代码。

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;

Seems like your problem might be elsewhere. 似乎您的问题可能在其他地方。 It sorta sounds like your combo box is regaining focus each time you type a letter. 听起来有点像您每次输入字母时组合框都重新获得焦点。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM