How to Convert Arraylist to Array in .net

Array is the group or collection of similar datatypes object and it is member of the system namespace whereas ‘Arraylist’ is the group of variables or object with different datatypes and it implement the ‘IList’ interface using an array whose size is dynamically increased as required.
Continue reading “How to Convert Arraylist to Array in .net”

How to set desktop background in vb.net

Windows API are the dlls that are the part of microsoft windows operation system. There are many task in the application development that are very difficult to handle in your own code for example if we have need to change background of your desktop via your application than what you do? Simple you can use User32 windows api for that.

.Net framework use plateform invocation services for it.plateform invocation services is the process by which .net framework communicate unmanaged code of api.

in this article we will discuss how to use User32 windows api for set the background of desktop or desktop wallpaper.

Continue reading “How to set desktop background in vb.net”

Code Snippet for detaching SQL database programmatically in vb.net

Following code is for detaching sql database programmatically

VB.Net Code :

Dim conn As SqlClient.SqlConnection

        Dim cmd As New SqlClient.SqlCommand()

        Dim ConnectionString As String = “Data Source=” & Server name & “;Initial Catalog=master;Integrated Security=True”  ‘ Connection string

        conn = New SqlClient.SqlConnection

        conn.ConnectionString = ConnectionString

        conn.Open()   ‘Open connection

        Dim sqlDetech As String = “sp_detach_db ‘”& database name &”‘, ‘true'”  ‘ Sql query for detaching database

        cmd.CommandText = sqlDetech

        cmd.Connection = conn

        cmd.ExecuteNonQuery()  ‘execute query