?
Solved

Basic webage to form

Posted on 2006-04-05
16
Medium Priority
?
234 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

0
Comment
Question by:aussiemale33
  • 6
  • 6
  • 3
15 Comments
 
LVL 9

Expert Comment

by:pradapkumar
ID: 16380872
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.
0
 

Author Comment

by:aussiemale33
ID: 16380990
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.
0
 
LVL 9

Accepted Solution

by:
pradapkumar earned 1000 total points
ID: 16381137
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
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 

Author Comment

by:aussiemale33
ID: 16381139
And this :

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


Still no go.
0
 
LVL 9

Expert Comment

by:pradapkumar
ID: 16381160
try to use
navigate2 method
and give me feedback.
0
 

Author Comment

by:aussiemale33
ID: 16381218
Tried :

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

Still no go.
0
 
LVL 86

Assisted Solution

by:Mike Tomlinson
Mike Tomlinson earned 1000 total points
ID: 16381252
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!
0
 

Author Comment

by:aussiemale33
ID: 16381364
he didnt explain it to me, told you I was a beginner, but thanks idle_mind ur solution has worked for me thank you.
0
 
LVL 9

Expert Comment

by:pradapkumar
ID: 16381385
Thanx for ur pointing policy and i appreciate u to finalize this question.
0
 
LVL 86

Expert Comment

by:Mike Tomlinson
ID: 16381437
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/
0
 

Author Comment

by:aussiemale33
ID: 16390549
Okay have requested.
0
 
LVL 86

Expert Comment

by:Mike Tomlinson
ID: 16391663
=)
0
 
LVL 9

Expert Comment

by:pradapkumar
ID: 16397819
Please leave it if that was not possible. And take it as experience and don't behave like this in future.
0
 

Author Comment

by:aussiemale33
ID: 16398099
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.
0
 
LVL 9

Expert Comment

by:pradapkumar
ID: 16398130
SOrry yar.:(
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month14 days, 4 hours left to enroll

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question