jeudi 12 janvier 2017

C# Disable a "Back Button" once there is no web site to get back to

so i'm basically learning C# and made myself a simple web browser and added "back" and "forward" buttons to navigate through sites that i opened. Well the thing is, i can't figure out how to disable them if there are no more sites to get back to.

i tried to put this simple code into my form's constructor, but it seems like it does not have any affect...

        if (webBrowser1.CanGoBack == false)
        {
            backButton.Enabled = false;
        }
        else
        {
            backButton.Enabled = true;
        }

I would be happy for any help, thanks!




Aucun commentaire:

Enregistrer un commentaire