mardi 5 octobre 2021

if statement to check if the user has left the text box empty - issue

I have a web form with a text box where the user enters a URL so by default I have put an https:// but if the user does not enter a URL after and leaves it empty I want to show an error. I have used

if (textBox1.TextLength <= 9)
{
    // code
}

but that wont work if the user tries to put in a ftp URL.

How do i change my if statement to check if the user has left the text box empty besides the default https://

Aucun commentaire:

Enregistrer un commentaire