This code demonstrates how to create CD ROM open and close calls. Create a Windows Forms Application and add two buttons. I will leave default names in this example Form1 for the form and Button1 and Button2 for buttons. I’ve changed the text property only.

Read more…
Here’s a small example of how to log off, restart and shutdown computer in Visual Basic. Open Visual Studio and create a new Windows Forms Application:

In the Solution Explorer right-click on ExitWindows –> Add –> Module… Leave the default name Module1.vb as is and click Add.
Paste the following code in Module1:
Public Declare Function ExitWindows Lib "user32" (ByVal uFlags As Long, _
ByVal dwReserved As Long) As Long
Public Const EWX_LOGOFF = 0
Public Const EWX_SHUTDOWN = 1
Public Const EWX_REBOOT = 2
Public Const EWX_FORCE = 4
Read more…
One of the best programming practices is to use DLL (Dynamic Link Library) files to re-use your code and controls across your applications. In this tutorial I will show you how to create a sample DLL file in Visual Basic .NET Professional edition and attach it to a new application.
1) Create a new project, select Windows Forms Control Library and name it MiniCalc

Read more…