Re: Little help with frames
To refresh just a single frame, you need to grab that frame, and navigate to its URL again. This may or may not work in all cases, but most pages that even use frames are pretty old now, as frames are somewhat depreciated for website design these days.
So anyways, to do this, basically something like this would work.
Code:
Dim FrameToRefresh = WebBrowser1.Document.Window.Frames(1)
FrameToRefresh.Open(FrameToRefresh.Url, "_self", "", True)
basically you get the frame you want to refresh (in this example, its the second frame since the index starts at 0), then once I get that frame, I call its Open method to open a URL in just that frame, and I pass in the URL that is currently in the frame. I pass in "_self" for the target so it will load the frame in the same spot.
Re: Little help with frames
Thanks kleinma
That worked and done just what i wanted it to do.
But how do i stop it refreshing lol it just keeps refreshing over and over again :confused:
Re: Little help with frames
You could set a flag (just simple boolean variable) which has an initial value of false. When your code is going to refresh the frame, check this flag, and if it is false, set it to true and then refresh the frame. Then when the routine fires again, your flag is true, no second refresh is done, and that should fix the problem.
Re: Little help with frames
Quote:
Originally Posted by
kleinma
You could set a flag (just simple boolean variable) which has an initial value of false. When your code is going to refresh the frame, check this flag, and if it is false, set it to true and then refresh the frame. Then when the routine fires again, your flag is true, no second refresh is done, and that should fix the problem.
/me googles flags lol
na thanks mate you pointing me in the right direction :)
/me gets his books out and reads about flags
Re: Little help with frames
well flag can mean a few things. In this case it is really just a switch like on or off.
Code:
'THIS SHOULD BE DECLARED AT THE CLASS LEVEL
Dim myFlag as boolean = false
'THIS WOULD BE IN YOUR DOCUMENTCOMPLETED ROUTINE
If myFlag = False then
myFlag = True
'REFRESH FRAME HERE
end if
see, so the flag here ensures the code to refresh the frame only happens once, because you set the flag to true the first time you refresh, so when the routine fires again, it will skip the code since the flag is now true.
Re: Little help with frames
Quote:
Originally Posted by
kleinma
well flag can mean a few things. In this case it is really just a switch like on or off.
Code:
'THIS SHOULD BE DECLARED AT THE CLASS LEVEL
Dim myFlag as boolean = false
'THIS WOULD BE IN YOUR DOCUMENTCOMPLETED ROUTINE
If myFlag = False then
myFlag = True
'REFRESH FRAME HERE
end if
see, so the flag here ensures the code to refresh the frame only happens once, because you set the flag to true the first time you refresh, so when the routine fires again, it will skip the code since the flag is now true.
nice one thanks mate i got a bit of code like that out of one of my books
thnx for all your help added to your rep