We help IT Professionals succeed at work.

Basic webage to form

aussiemale33
aussiemale33 asked
on
Medium Priority
257 Views
Last Modified: 2010-05-01
I have a main window that has this code on it :

Private Sub Form_Load()
    Call WebBrowser1.Navigate("http://www.absolutelyhonest.com/demo/chat/stateless/flashchat.php")
End Sub



I want to add another window on the form to load a different website, so I draw the internet tools window, and I get this code :

Private Sub WebBrowser2_StatusTextChange(ByVal Text As String)

End Sub

How come its different to the above address, apart from the website address??

Is it as easy as adding :

Private Sub WebBrowser2_StatusTextChange(ByVal Text As String)
Call WebBrowser2.Navigate("http://www.google.com")
End Sub

To have another page load on the form? Or something like that, because it doesnt work.


This is the complete code of form1 :


Private Sub about_Click()
frmAbout.Show
End Sub

Private Sub Command1_Click()
Dim R As Long
R = ShellExecute(Me.hWnd, "Open", "http://www.jf3000.com/main2.php", vbNullString, vbNullString, vbNormalFocus)
             
'in case of no browser installed, R will be 0
If R = 0 Then
     If MsgBox("No browser installed! Cannot open help file.", vbOKOnly) = vbOK Then
         Exit Sub
     End If
End If
End Sub

Private Sub exit_Click()
Unload Me
End Sub

Private Sub Form_Load()
    Call WebBrowser1.Navigate("http://www.absolutelyhonest.com/demo/chat/stateless/flashchat.php")
End Sub

Private Sub tip_Click()
frmTip.Show
End Sub

Private Sub WebBrowser2_StatusTextChange(ByVal Text As String)

End Sub


I have search the database for an easy solution of adding a webpage to the form, and most answers are left confused, and I even wonder if the person who posted them also understood what the replies meant.

Being new at this, and lerning as I go along is really helpful.

Thank you.

Jf3000

Comment
Watch Question

U can simply add the following line to ur form load event to open another site in another web browser control.

Call WebBrowser2.Navigate("http://www.jf3000.com/main2.php")

No need to call shell commands,

I hope this will solve ur problem.

Author

Commented:
I tried this :

Private Sub WebBrowser2_StatusTextChange(ByVal Text As String)
Call WebBrowser2.Navigate("http://www.google.com")
End Sub


Doesnt work, what ur saying doesnt work. When u start saying no need to call shell commands u r losing me, im a noob, so youll have to explain please.

Thanks for the fast reply too.
you need to paste my code in Form_Load Event immediately below the webbrowser1.navigate method.

Try this.

It can also be called in Form_Activate Event too.

I can't understand why u used the shell command in ur code.
If u have any specific reason for that pls explain me.
If u used it to check whether it works or not it definetly not because the u r trying to open a 'php' file. not a 'html' file. to open it thru shell command u need to configure ur file types and their associated programs to your web browser. Then only it opens that page and returns the handle of the web browser. Then only the R will have some value in it. otherwise the command failures and returns 0 always.
Can u give meaning for >>noob<<?????????????
with regards
Pradap

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts

Author

Commented:
And this :

Private Sub Form_Load()
    Call WebBrowser2.Navigate("http://www.absolutelyhonest.com/demo/chat/stateless/flashchat.php")
End Sub


Still no go.
try to use
navigate2 method
and give me feedback.

Author

Commented:
Tried :

Private Sub WebBrowser2_StatusTextChange(ByVal Text As String)
Call WebBrowser2.Navigate2("http://www.www.google.com")
End Sub

Still no go.
Mike TomlinsonHigh School Computer Science, Computer Applications, Digital Design, and Mathematics Teacher
CERTIFIED EXPERT
Top Expert 2009
Commented:
As pradapkumar has already said...

If you have two WebBrowser controls (WebBrowser1, WebBrowser2) on your form then you should be able to load up a page in both of them at form load like so:

    Private Sub Form_Load()
        Call WebBrowser1.Navigate2("http://www.absolutelyhonest.com/demo/chat/stateless/flashchat.php")
        Call WebBrowser2.Navigate2("http://www.google.com")
    End Sub

REMOVE the WebBrowser2_StatusTextChange() code!

Author

Commented:
he didnt explain it to me, told you I was a beginner, but thanks idle_mind ur solution has worked for me thank you.
Thanx for ur pointing policy and i appreciate u to finalize this question.
Mike TomlinsonHigh School Computer Science, Computer Applications, Digital Design, and Mathematics Teacher
CERTIFIED EXPERT
Top Expert 2009

Commented:
pradapkumars very first comment explained what to do:

    "U can simply add the following line to ur form load event to open another site in another web browser control."

I just showed what he explained...you should have split the points, or giving them all to him.

You can request the question be reopened so you can distribute points differently here:
http://www.experts-exchange.com/Community_Support/

Author

Commented:
Okay have requested.
Mike TomlinsonHigh School Computer Science, Computer Applications, Digital Design, and Mathematics Teacher
CERTIFIED EXPERT
Top Expert 2009

Commented:
=)
Please leave it if that was not possible. And take it as experience and don't behave like this in future.

Author

Commented:
Dont behave? Excuse me? I asked a simple question, you did not explain it to me as I told you I was new at this. Idle_Mind  replied with what I was trying to do, simple.
SOrry yar.:(
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.