Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Close a browser before opening another

Status
Not open for further replies.

Grizz2

Programmer
Dec 4, 2001
52
US
Hi All,
Great, I finally found an active forum.
In my project a user can select an item to view online. This is not the complete code but gives the general idea.
Dim frmB As New frmBrowser

Then of course I open the browser when needed.
frmB.Show
I want to make sure that frmB hasn't already been created before opening another so the user doesn't end up with multiple browsers if they minimize instead of closing, before selecting another link. I tried setting a public variable to 1 when a browser was opened and to 0 when closed. Then doing

If(BrowserOpen = 1) Then
Unload frmB
End If

I also tried

If(BrowserOpen = 1) Then
Navigate to the link instead of opening a new browser.
Else
open a new browser

The Pub variable values worked but I still end up with a new browser each time. Any thoughts?
Thanks
Grizz2
 
Grizz,
I don't now if this is what you are looking for but I would use...
Code:
If frmB.Visible = True Then
   Unload frmB.Name
End If

hth
Scoty ::) "Learn from others' mistakes. You could not live long enough to make them all yourself."
-- Hyman George Rickover (1900-86),
 
Thanks Scoty
I ended up getting rid of the frmB as new and just loading the form. Made it easier to control. Thanks again for the help
Grizz2
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top