back button and forward button issue

Questions about programming languages and debugging
Post Reply
User avatar
CommonStray
Forum Assassin
Forum Assassin
Posts: 1214
Joined: 20 Aug 2005, 16:00
15

back button and forward button issue

Post by CommonStray »

whats up everyone, ok my problem is the back and forward buttons in a browser im developing within Visual Basic

ok so i know the

backbutton.GoBack

forwardbutton.GoForward

and they work, but only if the browser has something to go forward or back to...

so as you can see i get an error when i run my project and hit either button as the first thing i do.

error

so i fix that by disabling the buttons at form load and enable the back button when a i click the go button, and enable the forward button when i click the back button....

well the main issue is, how can i keep the back button from trying to go back to something that isnt there, when its "run out of pages to go back to or forwards to"

ive tried a few different IF Then statements but they didnt do the job

any ideas?

User avatar
bad_brain
Site Owner
Site Owner
Posts: 11532
Joined: 06 Apr 2005, 16:00
15
Location: The zone.
Contact:

Post by bad_brain »

Um, well...I don´t know much about VB, but I guess (because it´s OOP) there is surely a method which handles exeptions, in Java it´s the catch-method, here´s how a mathematical exeption can be handled (a division by 0 for example):

Code: Select all

catch (ArithmeticExeption exc) {
  System.out.println("Division by 0 not allowed!");
 }
Hope it helped a bit... :wink:

User avatar
CommonStray
Forum Assassin
Forum Assassin
Posts: 1214
Joined: 20 Aug 2005, 16:00
15

Post by CommonStray »

ok i figured out a way to keep it from creating an error

On Error Resume Next

If cwbr.CausesValidation = False Then
Call cantgoback
back_butt.Enabled = False
Else

cbwbTimer.Enabled = True


'Tells Browser to go back a page
cwbr.GoBack
End If

it just makes it so its non functional when trying to go back, good for now :?

User avatar
ilugd
Newbie
Newbie
Posts: 3
Joined: 15 Dec 2005, 17:00
15

Post by ilugd »

Isn't there some sort of array , history() or location() in the DOM model from which the lenght of the array can be found?

Post Reply