hi...again...i have a problem, here it is, when i wrote my code this error came up

Public Property currentbrowser As browser
        Get
            Return cb
        End Get
        Set(ByVal value As browser.browser)
            cb = value
        End Set
    End Property

Public Shared Sub Navigate(ByVal URL As String)
        cb.Navigate(URL)
    End Sub

inside sub navigate "cb" has an error it says "cannot refer to an instance member of a class form within a shared method or shared member initializer without an explicit instance of the class"

As the browser is an object, you may pass it by reference in the Set procedure

Set(ByRef value As browser)

Also, before calling the Navigate method on your class, be sure you set the currrentbrowser property to an already instantiated one.

As on the browser the Navigate method is not 'shared', calling it from a 'shared' procedure is not allowed.

Remove the Shared from the procedure definition to avoid this issue.

Hope this helps

Edited 6 Years Ago by lolafuertes: n/a

after i posted this i took of the

shared

peice of code and it worked fine but because this is inside a class file, i cannot access it anywhere else even though it is public. that is my new problem

I suppose that the properties and the method you described are inside a Class (lets call YourClass).

In order to access to your method (or properties) you need to instantiate your class. If you want to be always ready to be used, then you can do the following definition in a Module in your project.

Public YourClassInstance As New YourClass

After this, you must assign the browser to

YourClassInstance.currentbrowser = TheBrouserYouHaveAlready

Then, to navigate to the URL, from any part of your code

Dim DestinationURL as String = "http://noserver.nowhere.nodomain"
Call YourClassInstance.Navigate(DestinationURL)

Hope this helps

This article has been dead for over six months. Start a new discussion instead.