none
property access must assign to the property or use its value. RRS feed

  • Question

  • I have 2 vb files: sc.vb and mc.vb. they are created long time ago.

    in MC.vb:

    protected Store as sc

    Public Sub Insert(ByVal jMem As Integer, ByVal Name As String)
                Me.Store.set_ArrayInsert(Me.kCol, jMem, Name)
    End Sub

    in sc.vb, I cannot find set_ArrayInsert, only:

    Public WriteOnly Property ArrayInsertInt(ByVal kCol As Integer, ByVal iPos As Integer) As Integer
                Set(ByVal Value As Integer)

                End Set
    End Property

    I think they are same, so I update Me.Store.set_ArrayInsert(Me.kCol, jMem, Name) to Me.Store.ArrayInsert(Me.kCol, jMem, Name).

    but I got the error: property access must assign to the property or use its value.

    even I use Me.Store.ArrayInsert(1, 1, "aa").

    I don't use vb.net before, someone can tell me what the problem is?

    Thanks

    Wednesday, December 3, 2014 7:14 PM

Answers

  • The ArrayInsertInt property is an integer value and I think you are trying to store a string in it. It's possible that you are wrong in guessing that set_ArrayInsert and ArrayInsertInt are the same thing.

    I believe that the ArrayInsertInt property needs to be set like this

    Dim mySC as sc 'You need an instance of the sc class
    Dim someInteger = 12345 'Or whatever
    mySc.ArrayInsertInt(Me.kCol, jMem) = someInteger

    Wednesday, December 3, 2014 8:01 PM

All replies

  • The ArrayInsertInt property is an integer value and I think you are trying to store a string in it. It's possible that you are wrong in guessing that set_ArrayInsert and ArrayInsertInt are the same thing.

    I believe that the ArrayInsertInt property needs to be set like this

    Dim mySC as sc 'You need an instance of the sc class
    Dim someInteger = 12345 'Or whatever
    mySc.ArrayInsertInt(Me.kCol, jMem) = someInteger

    Wednesday, December 3, 2014 8:01 PM
  • thanks. you are right.
    Wednesday, December 3, 2014 8:04 PM
  • thanks. you are right.

    Hello,

    If Blackwood provided a helpful suggestion or has assisted you in solving this please mark his rely accordingly 


    Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem.

    Wednesday, December 3, 2014 8:08 PM
    Moderator