Page 1 of 2 12 LastLast
Results 1 to 10 of 18

Thread: RR VB.net plugin, need help !

  1. #1
    Raw Wave pierrotm777's Avatar
    Join Date
    May 2008
    Location
    Bordeaux, France
    Posts
    2,840

    Smile RR VB.net plugin, need help !

    I play with vb.net !
    I have made a Form with a WebBrowser window and two button:
    Code:
    Public Class WebPage
    
        Private Sub WebBrowser1_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted
            If e.Url.Host = "www.yahoo.com" Then
                WebBrowser1.Navigate("http://www.youtube.com")
            End If
            If e.Url.Host = "www.youtube.com" Then
                MsgBox("HELLO WORLD !!!", vbOKOnly, "Info")
            End If
        End Sub
    
        Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
            WebBrowser1.Navigate("http://www.yahoo.com")
        End Sub
    
        Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
            WebBrowser1.Navigate("http://www.youtube.com")
        End Sub
    
        Private Sub WebPage_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    
        End Sub
    
    End Class
    All run well, but i want to replace the two buttons by two RR commands into my RR plugin .

    So, i have tried that:
    Code:
        Public Function ProcessCommand(ByRef CMD As String, ByRef frm As Object) As Short
            Select Case LCase(CMD)
                Case "webpage_load"
                    Dim F As New WebPage
                    F.Show()
                    ProcessCommand = 2
    
                Case "webpage_yahoo"
                    WebBrowser1.Navigate("http://www.yahoo.com")
                    ProcessCommand = 2
    
                Case "webpage_youtube"
                    WebBrowser1.Navigate("http://www.youtube.com")
                    ProcessCommand = 2
    
            End Select
    
        End Function
    But i have an issue WebBrowser1 is not defined

    If someone can help me !

    Great thanks

  2. #2
    Confusion Master
    Auto Apps:loading...
    Enforcer's Avatar
    Join Date
    Sep 2003
    Location
    If you go down to the woods today, You're sure of
    Posts
    14,622
    you need to prefix webrowser1 with the name of the form it's on.



    ie

    fmWebbrowser.WebBrowser1

    if the form's name is fmWebbrowser

  3. #3
    Mo' Programming Mo' Problems
    Auto Apps:loading...
    Sonicxtacy02's Avatar
    Join Date
    Sep 2004
    Location
    Woodbridge, VA
    Posts
    8,168
    Blog Entries
    51
    Quote Originally Posted by Enforcer View Post
    you need to prefix webrowser1 with the name of the form it's on.



    ie

    fmWebbrowser.WebBrowser1

    if the form's name is fmWebbrowser
    and make sure your webbrowser1 object has proper scoping. It should be public because RR's ProcessCommand is public. If its private, friend, public shared etc you will run into object reference problems
    mp3Car.com Senior Tech Blogger (Want a product reviewed? Contact me.)
    Find my plugins on the MP3Car App Store!
    Follow Me on Twitter or Facebook
    Live mp3Car Facebook Chat

  4. #4
    Raw Wave pierrotm777's Avatar
    Join Date
    May 2008
    Location
    Bordeaux, France
    Posts
    2,840
    But what i must to change in this line please ?
    WebBrowser1.Navigate("http://www.yahoo.com")

  5. #5
    Confusion Master
    Auto Apps:loading...
    Enforcer's Avatar
    Join Date
    Sep 2003
    Location
    If you go down to the woods today, You're sure of
    Posts
    14,622
    Quote Originally Posted by pierrotm777 View Post
    But what i must to change in this line please ?
    WebBrowser1.Navigate("http://www.yahoo.com")

    Depends on what the name of the form on which the webbrowser1 control is.


    <formname>.WebBrowser1.Navigate("http://www.yahoo.com")


    without the '<' and '>'

  6. #6
    Raw Wave pierrotm777's Avatar
    Join Date
    May 2008
    Location
    Bordeaux, France
    Posts
    2,840
    My form is defined like that:
    Code:
    Public Class WebPage
    
        Private Sub WebBrowser1_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted
            If e.Url.Host = "www.yahoo.com" Then
                WebBrowser1.Navigate("http://www.youtube.com")
            End If
            If e.Url.Host = "www.youtube.com" Then
                MsgBox("HELLO WORLD !!!", vbOKOnly, "Info")
            End If
        End Sub
    
        Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
            WebBrowser1.Navigate("http://www.yahoo.com")
        End Sub
    
        Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
            WebBrowser1.Navigate("http://www.youtube.com")
        End Sub
    
        Private Sub WebPage_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    
        End Sub
    
    End Class
    so, i try to replace my buttons by this code but without success:
    Code:
        Public Function ProcessCommand(ByRef CMD As String, ByRef frm As Object) As Short
            Dim F As New WebPage
            Select Case LCase(CMD)
                Case "webpage_load"
                    F.Show()
                    ProcessCommand = 2
    
                Case "webpage_yahoo"
                    F.WebBrowser1.Navigate("http://www.yahoo.com")
                    ProcessCommand = 2
    
                Case "webpage_youtube"
                    F.WebBrowser1.Navigate("http://www.youtube.com")
                    ProcessCommand = 2
    
            End Select
    
        End Function

  7. #7

  8. #8
    Raw Wave pierrotm777's Avatar
    Join Date
    May 2008
    Location
    Bordeaux, France
    Posts
    2,840
    Quote Originally Posted by Enforcer View Post
    try webpage.webbrowser1
    vb.net don't accept

  9. #9

  10. #10
    Raw Wave pierrotm777's Avatar
    Join Date
    May 2008
    Location
    Bordeaux, France
    Posts
    2,840
    Quote Originally Posted by Enforcer View Post
    probably have to make the form a friend of the class or vice versa
    I am sorry but i don't understand what you say ! I am very bad with vb !

Page 1 of 2 12 LastLast

Similar Threads

  1. Replies: 27
    Last Post: 12-06-2009, 01:23 AM
  2. Replies: 6
    Last Post: 03-08-2009, 01:05 PM
  3. Replies: 6
    Last Post: 02-06-2009, 08:32 AM
  4. Replies: 16
    Last Post: 01-02-2006, 07:04 PM
  5. Winamp LCD display plugin / IRMan plugin - together?
    By Jarrod in forum Software & Software Development
    Replies: 9
    Last Post: 06-03-2002, 05:39 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •