Google在c#中映射自动填充文本框

我有一个餐厅交付WINFORM c#应用程序,在用户需要输入地址,以避免人为错误,我们正试图将谷歌地图的自动完成function集成到文本框中。 我用Google搜索了,我所看到的只是用于WINFORM的asp。 我尝试了一个代码但是它的命名空间丢失了,我不确定它是哪一个

使用的命名空间:

using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using Google.Api.Maps ; using GoogleApi.Helpers; 

inheritance人代码:

  private void textBox1_TextChanged(object sender, EventArgs e) { var autoCompleteListCollection = new AutoCompleteStringCollection(); autoCompleteListCollection.AddRange(new GoogleApi.Instance.GetAddressPredictionsByInput(textBox1.Text).ToArray()); textBox1.AutoCompleteCustomSource = autoCompleteListCollection; } 

错误:

错误1命名空间“GoogleApi”中不存在类型或命名空间名称“Instance”(您是否缺少程序集引用?)

我认为这可能有用。 所以请让我知道正确的命名空间或指导我如何达到上述要求

最后我得到了它的工作,但它崩溃的应用程序,inheritance人的代码:

  private void textBox1_TextChanged(object sender, EventArgs e) { string url = "https://maps.googleapis.com/maps/api/place/autocomplete/json?input=" + var + "&types=geocode&key=YOURAPIKEY"; string content = fileGetContents(url); JObject o = JObject.Parse(content); List add = new List(); try { JObject jObj = (JObject)JsonConvert.DeserializeObject(content); int count = jObj.Count; for (int i = 0; i  -1) { System.Net.WebClient wc = new System.Net.WebClient(); byte[] response = wc.DownloadData(fileName); sContents = System.Text.Encoding.ASCII.GetString(response); } else { System.IO.StreamReader sr = new System.IO.StreamReader(fileName); sContents = sr.ReadToEnd(); sr.Close(); } } catch { sContents = "unable to connect to server "; } return sContents; } 

每次我在几次尝试后都会跑,它会崩溃。 谢谢