Write a program using user defined and existing namespace in vb.net



Write a program using user defined and existing namespace in vb.net



steps to program using user defined and existing namespace in vb.net


Note here I am using visual express 2012.



1)Create your console application


console application

Ok now as you see in the image click on the "file" button at left-corner after clicking click on the "New project" after clicking on new project click on "console application" and give the name you like and click on ok,here I am giving Helloworld for my program.


As, you have clicked on ok you will be seee such interface




2)Creating a class in vb.net


Steps to create class



  • Right click on the solution explorer


  • cick on the "Add" element as shown in image

  • And now click on on "new item"


  • And now click on on "Class"

  • Here I am taking default class name which is class1.vb.As a begineer you should take this as default or you can take diffrent name as the class name


3) Adding code in vb.net


yo! your screen is blank now yes there is start and end class and nothing more let's fill some code :p


Namespace softwarebulls
Public Class blog
Public Shared Sub use()
Console.WriteLine("what is your name")

End Sub
End Class
End Namespace


This what your code look likes :)



ok we are not complated now ! we need to add code into module.vbs

click on the module part which is right side of the class here is how to do:



now paste this code in module.vb




Imports Hello.softwarebulls
Imports Microsoft.VisualBasic
Module Module1
Sub Main()
blog.use()
Console.ReadLine()
MsgBox("Good afternoon")
End Sub
End Module


now it's time to run click on start at upper bar take refrence from below image:




after running you will see like this



Now press any key !


you will seee such interface



Yes finally we done with a program using user defined and existing namespace in vb.net




Comments