Share via


what does "Property access must assign to the property or use its value" means?

Question

Monday, March 26, 2007 7:20 PM

Hi, I am using .net 1.x here, trying to pre-select a binded checkbox list, but it complains:

Property access must assign to the property or use its value

 

I'm not sure what I did wrong with my code, would anyone please take a look at it for me please?

[code asp.net]

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

         'load the checkboxlist with value from myClass
        cblst.DataSource = myClass.getCheckBoxList()
        cblst.DataBind()

        'pre-select my checkboxlist

        Dim bary As System.Collections.BitArray
        bary = myClass.getBitArray()                      <--  when running in debug mode, it seems like bary didn't pick up the bitarray i've generated

                                                                         <-- at this point, if i type bary.count at command prompt, that error on the subject line will show
 

        For i As Integer = 0 To cblst.Items.Count
            If (bary(i) = True) Then
                cblst.Items(i).Selected = True
            End If
        Next
End Sub 

 

 

thank you 

All replies (1)

Monday, March 26, 2007 7:27 PM âś…Answered

when using the immediate window in visual studio during debugging, you can either assign a new value to a property or read a property value.

is sounde like you typed: 

    bary.Count

This neither assigns a new value nor does it read the current value. 
To display a value, you would type

    ? bary.count

the leading question mark means: Print
this causes the property value to appear as output text in the immediate window.