Hi
Please tell vb.net equivalent of following method:
C# Syntax

public class RecentPosts : Control
  {

    static RecentPosts()
    {
      BuildPostList();
      Post.Saved += new EventHandler<SavedEventArgs>(Post_Saved);
      Post.CommentAdded += delegate { BuildPostList(); };
      Post.CommentRemoved += delegate { BuildPostList(); };
      Post.Rated += delegate { BuildPostList(); };
      BlogSettings.Changed += delegate { BuildPostList(); };
    }
}

I tried using C# to VB.NET code converter which gave me this:
VB Syntax

Public Class RecentPosts
		Inherits Control

		Shared Sub New()
			BuildPostList()
			Post.Saved += New EventHandler(Of SavedEventArgs)(Post_Saved)
			Post.CommentAdded += Function() Do
				BuildPostList()
			End Function
			Post.CommentRemoved += Function() Do
				BuildPostList()
			End Function
			Post.Rated += Function() Do
				BuildPostList()
			End Function
			BlogSettings.Changed += Function() Do
				BuildPostList()
			End Function
		End Sub
End Sub

build in visual studio 2008 gives an error.

Please help

Recommended Answers

All 2 Replies

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.