rss reader  
Author Message

PostPosted: Visual Basic Express Edition, rss reader Top


I've been watching lesson 15 now and i'm stuck on this bit, the highlighted bit is the error in vb, does anyone know the solution, i've tried the online help feature but that didn't do it

Dim currentchannel As rssDataSet.ChannelRow

For Each currentchannel In RSSReader.rssDataSet.Channel.Rows
Dim result As arrylist
result = RssManager.rssrefresh(currentchannel.URL)

Dim currentNewsItem As NewsItem
For Each currentNewsItem In result

Dim title As String
title = currentNewsItem.Title

If title.Length >= 50 Then
title = title.Substring(0, 49)
End If

title = title.Replace("'", "")

Dim filterexpression As String
filterexpression = "Title '" & title & title & "'"

Dim filteredNewsItems() As System.Data.DataRow
filteredNewsItems = myRssDataSet.NewsItem.Select(filterexpression)

If filteredNewsItems.Length = 0 Then

Dim newRow As rssDataSet.NewsItemRow = myrssdataset
newRow.Title = currentNewsItem.Title
newRow.Description = currentNewsItem.Description
newRow.Link = currentNewsItem.Link
newRow.ChannelID = currentNewsItem.channelID
newRow.DateAcquired = currentNewsItem.dateacquired


End If

Visual Studio Express Editions42  

PostPosted: Visual Basic Express Edition, rss reader Top

As you dont state what the error is, its difficult to give you an answer but my thoughts would be that you have either not added a reference to a class library which is containing the RSSReader class or are missing an imports statement which means that you would need to provide a fully qualified name for the class.

What is the error that it is giving you


PostPosted: Visual Basic Express Edition, rss reader Top

the error description is:

Reference to a non-shared member requires an object reference


PostPosted: Visual Basic Express Edition, rss reader Top

This error normally occurs when you are refering to an item in a class which isnt an instance.  SO in the following example I have defined a class with a shared member and instance method and call the method correctly and incorrectly for both.   With this in mind itwould probably be that you are calling the method on a type when it requires an instance.  

So you are probably missing the code which creates the instance for that collection.


Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim i As Integer = 0
        Dim o = New Foo

        i =  '//Correct for Instance Method
        i = '//Reference to a non shared member requires an object reference

        Dim b As Integer = 0
        b = o.Sharedbar '//Access of shared member through an instance, qualifying expression will not be evaluated
        b = Foo.Sharedbar '//Correct For shared method

    End Sub
End Class

Public Class Foo
    Public Function bar() As Integer
        Return 1
    End Function

    Public Shared Function Sharedbar() As Integer
        Return 2
    End Function
End Class




Note,     If you look at 13:21 in the lesson, the line should read

For each currentChannel in myRssDataSet.Channel.Rows