Focusing WebBrowser control in a C# application

前端 未结 4 1707
-上瘾入骨i
-上瘾入骨i 2020-12-20 19:17

I have a WebBrowser control hosted in a windows Form. The control is used to display hyperlinks which get created at runtime. These links point to

4条回答
  •  借酒劲吻你
    2020-12-20 19:40

    This is my solution

    private void txtAdres_KeyPress(object sender, KeyPressEventArgs e)
    {
        int licznik = 1;
        if (e.KeyChar == (char)13)
        {
            string adres = txtAdres.Text;
            webBrowser1.Navigate(adres);
            licznik = 0;
        }
        if (licznik == 0)
        {
            webBrowser1.Focus();
        }
    }
    

提交回复
热议问题