IT Project Manager

http://www.alamzyah.co.nr are the website that you can learn all about becoming a great IT Project manager, come and visit this web directly.

Advertisements

Create a Windows Service using VB.NET

Ok, its time for one more tutorial. This times pick is Windows Services. Creating Windows Services is not a big deal using Visual Basic. Just follow few simple steps and you are all set to run and test your first Windows Service.

Windows Services is new name for NT Services you used to develop in previous versions of Visual Studio. This tutorial walks you through how to create and use your Windows Services. This Service writes some text to a text file when stop and start the service. The base idea is taken from MSDN but its more elaborated. You can modify it according to your needs.

Step 1. Create Skeleton of the Service

To create a new Window Service, pick Windows Service option from your Visual Basic Projects, give your service a name, and click OK.

The result look like this. The Wizard adds WebService1.vb class to your project.

Set your ServiceName to your own name so it would be easier to recognize your service during testing OR you can set this property programmatically using this line Me.ServiceName = “mcWinService”

This is the name you will be looking for later :).

Read more of this post

How to make a DLL with VB.NET Standard Edition

When you ask in forums which edition of Microsoft Visual Basic .NET you should buy, most experienced programmers will tell you to go for anything but the standard edition. Why? Well, they say that you can’t make .dll’s and all the good pro stuff with the standard edition. I got news for you: you can make your .dll’s with the standard edition. In fact, you can use the Class Library, Windows Control Library, Web Control Library, yep, and even Windows Service.

In this tutorial, I will show you how you can produce your .dll. Don’t expect something complicated. Our example here will be a simple button, so if you want something more elaborated than that, you will have to work that out on your own. By the way, when you’re through with this one, go to Ged Mead’s tutorial on how to make a custom control; this gets you some more practice.

Start a new Windows Application project and give a name; “My Button” will be fine here. This should look like in Figure 01.

(Figure 01)

From the file menu, select “Add New Item”, or press Ctrl + Shift + A to do the same. This will open the “Add New Item – My Button” window. In the “Add New Item” window, select the User Control template and name it “My Button.vb” as shown in Figure 02. Click to open it.

(Figure 02)

Read more of this post

Create DLL Using Visual Basic.Net

A DLL (Dynamic Link Library) is a file that can be loaded and executed by programs dynamically. The main advanatage in using DLL is several can use the same DLL during their execution.

Use of DLL (Dynamic Link Library)

Here are the key points that will guide you in understanding DLL.

  • When we want to hide our code from the user then we make DLL (Dynamic Link Library) and add these in other application now no body can open this.
  • When we want to use same code in different applications (REUSABILITY) then we make DLL of that code and add that code in other applications.
  • When you want to use Functions of C# in Vb.net then you will make DLL of C# and add this library in VB.net and can easily use its functions.

Examples:

There are many Examples of DLLs in .net. You are familiar with different DLLs like

—————————————————————-

System.Data

System.Drawing

System.Globalization

—————————————————————-

Now here System is a DLL and further are its classes. We can make classes in a class and make functions in class like

—————————————————————-

System.Data.SqlClient

SqlClient is a class in Data Class.

System.Data.SqlClient.SqlConnection

—————————————————————-

Now in this sqlconnection is a function of class sqlclient. We all know that we can just use these functions but can’t see there code. So this is a very useful concept.

This is a Advance topic but if beginner study this they can do this easily. In this simple article you will learn to make DLL (Dynamic Link Library) in VB.Net application.

Follow these steps to  make new DLL

—————————————————————

File New Project

Now open a new window with title New Project. Now select Class library from this and write its name MyDLL and Press OK.

Now there is no form in this project there it shows Class1.vb file. Now you can write code of your specified function which you want in your DLL.

—————————————————————-

Public Class Class1

End Class

—————————————————————-

Initially here is this code only for class. Now you can create your own function in this class. We will write functions for addition of two number, subtraction of two numbers, multiplication of two numbers, division of two numbers.

—————————————————————-

Public Class Class1

Public Function ADD(ByVal first As Integer, ByVal sec As Integer)

Dim abc As Integer

abc = first + sec

Return abc

End Function

 

Public Function Subtraction(ByVal first As Integer, ByVal sec As Integer)

Dim abc As Integer

abc = first – sec

Return abc

End Function

 

Public Function Multiplication(ByVal first As Integer, ByVal sec As Integer)

Dim abc As Integer

abc = first * sec

Return abc

End Function

 

Public Function Division(ByVal first As Integer, ByVal sec As Integer)

Dim abc As Integer

abc = first / sec

Return abc

End Function

End Class

—————————————————————-

Now This is the code and your own DLL is ready for attach with some other application.

This is a Advance topic but if beginner study this they can do this easily. In this simple article you will learn to use DLL (Dynamic Link Library) using VB.Net.

Follow these steps to  ADD new DLL

First create a new project and now

Select DLL file and place it in the project folder which you make before.

Project Add References

Now there opens a window it has three tabs select third tab named projects. Now browse DLL file MyDLL which you place before and press OK. Your DLL is added in references of project. Now you can use it easily.

Now drag two numeric up down, four buttons and a textbox on the form1.

—————————————————————-

Numeric Up Down 1 having name txt1.

Numeric Up Down  2 having name txt2.

Textbox 1 with name txtresult

—————————————————————-

Now write code on form1 load event

—————————————————————-

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)

_HandlesMyBase.Load

TXT1.Value = 5

TXT2.Value = 10

TXTRESULT.Text = 0

End Sub

—————————————————————-

Now write code against buttons

—————————————————————-

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)

_HandlesButton1.Click

Dim a As New MyDLL.Class1

TXTRESULT.Text = a.ADD(TXT1.Text, TXT2.Text)

End Sub

 

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)

_HandlesButton2.Click

Dim a As New MyDLL.Class1

TXTRESULT.Text = a.Subtraction(TXT1.Text, TXT2.Text)

End Sub

 

Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)

_HandlesButton4.Click

Dim a As New MyDLL.Class1

TXTRESULT.Text = a.Multiplication(TXT1.Text, TXT2.Text)

End Sub

 

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)

_HandlesButton3.Click

Dim a As New MyDLL.Class1

TXTRESULT.Text = a.Division(TXT1.Text, TXT2.Text)

End Sub

—————————————————————-

Now you can make this form using your DLL and nobody can see its code.