VB.NET Support - Reference to a non shared member requires an object reference


#1

Imports Couchbase.Lite
Imports Couchbase.Lite.Database

Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click

    'Couchbase Section

    'Setup a Manager to manage the connection as a Shared Instance
    Dim manager As New Couchbase.Lite.Manager
    Dim options As New Couchbase.Lite.ManagerOptions

    manager = Manager.SharedInstance

    TextBox1.Text = "Manager Created"

    'Create the database  -- the database name MUST be lower case
    Dim dbName = "fhello"
    manager.GetDatabase(dbName)
    TextBox1.Text = "Database Created"

    Dim mbSubject As New mbClass
    With mbSubject
        .SSN = "123-45-6789"
        .First = "John"
        .Last = "Smith"
    End With

    'Setup the Database

    Dim properties As New Dictionary(Of String, Object)() From {
{"title", "Little, Big"},
{"author", "John Crowley"},
{"published", 1982}

}
Dim document = GetDocument(“978-0061120053”)
'Debug.Assert(document IsNot Nothing)
Dim rev = document.PutProperties(properties)
Debug.Assert(rev IsNot Nothing)

End Sub

End Class


#2

@todd_bryant -

Can you post the entire exception including the stacktrace?

-Jeff


#3

Hi Jeff, thanks for the reply. I turns out that I needed to dim database=manage.GetDatabase(dbName) on line 20, and
dim document= database.GetDocument(“978-0061120053”) on line 40.

Thanks for your help.

Imports Couchbase.Lite
Imports Couchbase.Lite.Database

Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
’Couchbase Section

'Setup a Manager to manage the connection as a Shared Instance
Dim manager As New Couchbase.Lite.Manager
Dim options As New Couchbase.Lite.ManagerOptions

manager = Manager.SharedInstance

TextBox1.Text = "Manager Created"

'Create the database  -- the database name MUST be lower case
Dim dbName = "fhello"
Dim database = manager.GetDatabase(dbName)
TextBox1.Text = "Database Created"

Dim mbSubject As New mbClass
With mbSubject
    .SSN = "123-45-6789"
    .First = "John"
    .Last = "Smith"
End With

'Setup the Database

Dim properties As New Dictionary(Of String, Object)() From {

{“title”, “Little, Big”},
{“author”, “John Crowley”},
{“published”, 1982}

}
Dim document = database. GetDocument(“978-0061120053”)
'Debug.Assert(document IsNot Nothing)
Dim rev = document.PutProperties(properties)
Debug.Assert(rev IsNot Nothing)
End Sub

End Class