Click here to Skip to main content
15,886,757 members
Please Sign up or sign in to vote.
4.00/5 (2 votes)
See more:
I have written the following code:

Dim selectedFrame = (From SF In TOCFrames Where SF!Model = cboModel.Text Select SF!Model, SF!Colour, SF!PROS_Design, SF!PROS_Description)
For Each Item In selectedFrame
    If Not IsDBNull(Item.Colour) Then
        txtColour.Text = Item.Colour
    Else
        txtColour.Text = ""
    End If

    If Not IsDBNull(Item.PROS_Design) Then
        txtDesign.Text = Item.PROS_Design
    Else
        txtDesign.Text = ""
    End If

    If Not IsDBNull(Item.PROS_Description) Then
        txtDescription.Text = Item.PROS_Description
    Else
        txtDescription.Text = ""
    End If
Next


Which normally works however is not working at the moment. I have an error message that says:

Error 55 'Item' is not declared. It may be inaccessible due to its protection level.


I have tried to search the internet for a solution, however have been unsuccessful with this. If anyone would help me out then that would be great!
Posted
Comments
Herman<T>.Instance 26-Nov-13 11:25am    
is Option Strict ON?
For Each Item As <objecttype> In selectedFrame
TnTinMn 26-Nov-13 18:40pm    
Which line is is indicated as having the error.

If I had to guess, it would be the LINQ statement.

You are using an antiquated syntax in that statement to index the default property of "SF".

SF!Model could be the same as SF.Item("Model"); typically, the default property is named "Item".

See this article[^], it should point you in the right direction.
 
Share this answer
 
The problem was that I had option explicit on and also was not looping Item as object.

Thank you all for your help!
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900