简单代码C#winform应用程序(visual studio 2010):
带有一个文本框的简单表单是一个按键事件:
private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
{
// The keypressed method uses the KeyChar property to check
// whether the ENTER key is pressed.
if (e.KeyChar == (char)Keys.Return)
{
Process.Start("http://yahoo.com", null);
}
}
我需要将文本框更改为autocompletemode=suggestappend和autocompletesource=customsource。然后我把它填成这样:
private void Form1_Load(object sender, EventArgs e)
{
AutoCompleteStringCollection s = new AutoCompleteStringCollection();
s.Add("Jon ");
s.Add("2 Jon");
textBox1.AutoCompleteCustomSource = s;
}
困惑:)。