Recent Articles

Step-by-step Creating a DotNetNuke Module Using Visual Basic (VB.NET)

I'll show you how to create a simple DotNetNuke 4.x module using VB.NET. Modules can be created with C# also just as easily.


You'll need a few tools before you can begin:

Adding New Item

On the Solution Explorer, right mouse on the root site and click on Add New Item.... 

DotNetNuke Module Creation Add New Item

You should now see a dialog box asking you to select the item to add. DotNetNuke allows you to build modules in either VB or C#. In this example, select Visual Basic as the preferred language. Give your module a name like "HelloWorld".

DotNetNuke Module Creation Add New Item Dialog VB

Adjust the Module Folders & Code

You'll quickly notice that the name of the module folder is always "ModuleName" even if I explicitly called it "HelloWorld" in the previous dialog. Visual Studio has limited capabilities to customize templates and this limitation is apparent in the screenshot below. You'll have to manually rename App_Code\ModuleName to App_Code\HelloWorld and DesktopModules\ModuleName to DesktopModules\HelloWorld before continuing. The files contained within the folder are named correctly and you don't need to modify those.

DotNetNuke Module Creation Add New Item ModuleName limitation

Install the DNN Manifest

You're now ready to install the module. From your web site, go to Host > Module Definitions page from the menu. On the top left corner of the title header, click on Create New Module.

DotNetNuke Module Creation Create New Module

The HelloWorld.dnn file contains all the information necesary such as location of files, version and name. Select the HelloWorld.dnn manifest file and click on Create new Module from selected Manifest file.

DotNetNuke Module Creation Create New from Manifest

Create Tables and Stored Procedures

To install the HelloWorld module to your web site, you'll need to create a custom table and several stored procedures that performs some simple insert, update and delete operations for the custom table. This is part of the simple HelloWorld functionality when you use the VSI template to create a module.  A simpler module, if created by hand, would not require any table or stored procedure at all. Since we want to make use of the VSI template, just open the DesktopModules\HelloWorld\01.00.00.SqlDataProvider file using notepad and copy the SQL content. Then from your web site, go to the Host > SQL page from the menu. Execute the SQL and check the Run as Script to tell the page to parse the SQL and replace any special DotNetNuke specific syntax.

DotNetNuke Module Creation Execute SQL

Add Module To Page

Congratulations! You've created your first module. You can now go to any page and add the HelloWorld on to that page.

DotNetNuke Module Creation Add Module 

The HelloWorld allows you to add, edit and configure settings for the module. Have fun !

DotNetNuke Module Creation View Module