|
-
Dec 23rd, 2009, 12:31 PM
#1
Thread Starter
Fanatic Member
[RESOLVED] Opening New Window problem
Hi ,
im starting a new program and im stuck already lol , im using a webbrowser control , when i open a new window i cant seem to get the new window to navigate to a different webpage. Heres my current code.
Code:
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
WebBrowser1.Navigate("http://www.playstationevents.com/mainforum/index.php?action=forum")
WebBrowser1.ScriptErrorsSuppressed = True
End Sub
Private Sub Fifa10ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Fifa10ToolStripMenuItem.Click
Dim new_window As New Form1
new_window.WindowState = FormWindowState.Normal
new_window.Show()
End Sub
End Class
-
Dec 23rd, 2009, 01:49 PM
#2
Fanatic Member
Re: Opening New Window problem
Okay, these functions don't interact with eachother in any way so I don't see why you shouldn't be able to navigate your WebBrowser after opening the Form new_window.
Maybe the code you are using to navigate are malfunctioning, however if you are saying that your Form_Load Sub isn't working, try to disable the toolstrip sub and run the code.
*EDIT* To navigate from another window, you need to 'call' the window which has the form and then its object,
Form1.WebBrowser1.Navigate("http://google.com")
-
Dec 23rd, 2009, 03:19 PM
#3
Thread Starter
Fanatic Member
Re: Opening New Window problem
Its is navigating , on the form_load. i want the new window to navigate to a different web page when i open the new window.
-
Dec 23rd, 2009, 05:05 PM
#4
Fanatic Member
Re: Opening New Window problem
then my dear friend, you need to alter the new_window_Load() event into navigating the WebBrowser, or since you are creating the window programatically, you could add the navigation in the same event as on the ToolStripMenuItem_Click()
-
Dec 24th, 2009, 09:30 AM
#5
Thread Starter
Fanatic Member
Re: Opening New Window problem
 Originally Posted by Zeelia
then my dear friend, you need to alter the new_window_Load() event into navigating the WebBrowser, or since you are creating the window programatically, you could add the navigation in the same event as on the ToolStripMenuItem_Click()
ive tried that wont work either
Code:
Dim new_window As New Fifa_leagues
new_window.WindowState = FormWindowState.Normal
new_window.WebBrowser1.Navigate("http://fifa10league.leaguerepublic.com/ProcessPublicSelect.do?psSelectedSeason=1924592&psSelectedDivision=1273027&go=Go&psSelectedLeague=1647378")
new_window.Show()
-
Dec 24th, 2009, 04:48 PM
#6
Fanatic Member
Re: Opening New Window problem
Well, a question:
Do you want to navigate within a new webbrowser control or the one existing in Form1?
So now, do you already have a form called Fifa_leagues? or are you going to open the form programatically as you wrote in post #1?
If you already have a form, you don't need to re-declare it, you can write something like this:
Code:
Fifa_leagues.Show() 'Create the form
Fifa_leagues.WebBrowser1.Navigate("http://fifa10league.leaguerepublic.com/ProcessPublicSelect.do?psSelectedSeason=1924592&psSelectedDivision=1273027&go=Go&psSelectedLeague=1647378") 'Navigate
As for creating an object programatically on a programatically created form, I don't know...
Just try to be as explicit as possible, if you create a new form, declare the width, height and position of the form. Do this for the WebBrowser aswell, to make sure that the width and height isn't set to 0 (invisible).
-
Dec 24th, 2009, 05:00 PM
#7
Thread Starter
Fanatic Member
Re: Opening New Window problem
Yes im using another form and im currently using the code you posted above , but im trying to open another window of form 1 and navigate to a different page within the new window.
Last edited by dunlop03; Dec 24th, 2009 at 05:06 PM.
-
Dec 24th, 2009, 05:14 PM
#8
Fanatic Member
Re: Opening New Window problem
Okay, but do you really need to create the new form programatically?
It would be alot easier adding a new form to the project with an existing WebBrowser.
I might have misunderstood you but if you aren't opening the form programatically, the code in post #6 should work for you.
-
Dec 24th, 2009, 05:18 PM
#9
Thread Starter
Fanatic Member
Re: Opening New Window problem
yes im using the code in post 6 to open it , think ill just go ahead with that , probably the best option.
Thanks for your help m8.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|