.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal

Home >> Articles >> ASP.NET >> Post New Resource Bookmark and Share   

 Subscribe to Articles

Application running at run time

Posted By:Gowthammanju       Posted Date: July 29, 2011    Points: 200    Category: ASP.NET    URL: http://www.dotnetspark.com  

These article explains about running of of application in window start up at boot up time

This technique allow us to run application at boot up time as

here it is for both vb.net and c#.net

step1: include namespace as

 for vb application as
Imports Microsoft.Win32

for c# application as

using Microsoft.VisualBasic;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Diagnostics;
using Microsoft.Win32;

step 2: declare the regKey variable as

Dim regKey As RegistryKey = Registry.CurrentUser.OpenSubKey("SOFTWARE\Microsoft\Windows\CurrentVersion\Run", True)


RegistryKey regKey = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true);

step 3:The first parameter is a name or path of the SubKey to open, while second parameter stands for access to the key (true means writable and false understandably means not writable).

Ok it seems that we are ready to set the value of the regKey:


regKey.SetValue("MyAppName", Application.ExacutablePath.ToString)


regKey.SetValue("MyAppName", Application.ExacutablePath.ToString)

In some situations you may want to check out the value or the certain registry Key

If regKey.GetValue("MyAppName") Is Nothing Then
   'To Do: something
   'To Do: something
End If

if (regKey.GetValue("MyAppName") == null) {
//To Do: something
} else {
	//To Do: something

 Subscribe to Articles


Further Readings:


No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More Articles on C#, ASP.Net, Vb.Net, SQL Server and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend