I am creating a URL search form where the users can press the enter key to make a decision. How can I disable the enter key if the user presses it when there are no letters or numbers entered in the search form? As it is now, if the user presses the enter key while the input form is not filled out, it will crash.
private void txtUrl_KeyUp(object sender, KeyEventArgs e)
{
if (e.Key == Key.Enter)
wbSample.Navigate(txtUrl.Text);
}
When the user types in any URL that exists on the web and presses enter, it will display any site via the code below.
wbSample.Navigate(txtUrl.Text);