Home     |     MS SQL Server    |     MS SharePoint    |     MS Visual Studio    |     MS Certifications    |     MS CRM     |     MS Office    |     MSF


Cervo Technologies
The Right Source to Outsource

Microsoft Sharepoint Portal Server

Hello World Webpart in Visual Basic


I created a "Hello World!" webpart in C#, but soon realized I needed
one in VB .Net.  I created the VB .Net webpart the same way as the C#
webpart.  I created a class library on a machine that was not the
Sharepoint Box.  I added a reference to System.Web.  I strongly named
both, then I built both applications.  Then I pushed the .dll files
into the global assembly cache on the actual server and created safe
controls for both.  When I went to the webpart gallery in MOSS 2007
the only visible webpart was the C# version.  I have tried numerous
IIS Resets and checked the Safe Control Entries multiple times by
copying and pasting the PublicKeyToken ID.  Here is my VB .Net Code:
Imports System
Imports System.Web
Namespace ClassLibrary5
    Public Class AnotherSimpleWebpart
        Inherits System.Web.UI.WebControls.WebParts.WebPart
        Protected Overrides Sub Render(ByVal writer As
System.Web.UI.HtmlTextWriter)
            writer.Write("HelloWorld!")
            MyBase.Render(writer)
        End Sub
    End Class
End Namespace

Here is my safe control:
<SafeControl Assembly="ClassLibrary5,Version=1.0.0.0,
Culture=neutral,PublicKeyToken=0689a694ac06fe62"
Namespace="ClassLibrary5" TypeName="AnotherSimpleWebpart" Safe="True" /


If anyone has any suggestions I am all ears.  Thanks for the help.
Sincerely,
Becky Isserman
Hi Becky,
have you unregistered the web part written in C#?

Maybe there is a naming conflict..

/Daniel Bugday

"Becky Isserman" <jadedi@gmail.com> wrote in message

news:1178723048.246408.229240@e65g2000hsc.googlegroups.com...

On 9 May, 16:04, Becky Isserman <jadedi@gmail.com> wrote:

I've also had a problem developing a VB web part, using the Microsoft
tutorials. The problem I discovered was that when creating a class
library in VB it used an already defined root namespace. If you right
click on your project and go to properties, then clear the contents of
the root namespace then rebuild your part and put it on the server it
should work.

I actually emailed Microsoft about this as it took a few days to
discover such a simple error. I asked them to put a one sentence
disclaimer in their web part tutorials but they emailed back saying it
wasn't an issue. C'est la vie.

Add to del.icio.us | Digg this | Stumble it | Powered by Megasolutions Inc