Page 1 of 1

back button and forward button issue

Posted: 07 Sep 2005, 11:48
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?

Posted: 07 Sep 2005, 12:18
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:

Posted: 07 Sep 2005, 12:39
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 :?

Posted: 27 Dec 2005, 04:42
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?