Create a Setup Application for your project using Microsoft visual studio 2008 just in 1 min

Create a Setup Application for your project using Microsoft visual studio 2008

To Create a Setup project for your application you can use MVS2008 Setup wizard. In this article i show you how to do this.This is the simplest way of doing it but if you want to add more features you can also customize it.

Using Setup wizard it creates two files
  • Setup.exe - Include a bootstrap to look prerequisite 
  • <application>.msi
You can also customize the Setup project preperties
To do this you must already open a application.For demo just create a simple application.In these examples i create email sender application that send emails.

File -> Add New Project and Select other Project types -> Setup and Deployment -> Setup wizard.
Name the project and click OK.

after that Setup wizard is open. click Next.

Select create a setup for windows application and click Next.

tic Primary Output from email and click Next. 

In here you can add additional files for your setup directory such as Readme file.. after adding additional files click Next to continue.

Click Finish.

Now you can see in the Solution Explorer setup files is there..

In the Properties window you can change the author , company name and lot of things there..

Now in the menu area select Build -> Build Setup(Your setup name). In my pro Build -> Build Email Setup

After that go to your project directory in there you can see the setup(Your Setup name Dir) folder.Inside that folder double click Debug. Now you can see that .exe file , .msi file. Double click setup.exe and it will install the file to your computer.

Now go to default installation directory path and you can see the file is there with .exe extension and other additional files that you add in your installation.

Also you can uninstall the file in Control panel or simply right click the project file to uninstall it.


Build Mobile Database Application using Microsoft Visual studio 2008 just in 5min - Video Tutorial

Create a Windows Mobile Database application Using Microsoft Visual studio 2008

In this article i'll show you how to create a windows mobile device application using MVS 2008.
but first you need to know some basics..
simply click this link to get some basic knowledge.......

Before creating the application you need to know some basics about SQL Server Compact. Because you use SQL Server Compact as your database.

SQL Server Compact 3.5

  • Data Stored in .sdf file
  • Create amd manage this database using SQL Server Management studio or Visual Studio
  • No Stored Procedure and views

First launch the visual studio 2008 and select New -> Project -> Smart Device  and give the project name as MobileDatabaseApp and click OK.

Select Target Platform as Windows mobile 6 Professional SDK and select Device application and click OK.

After that you need to create a Database file for this. To do that in Menu select Data -> Add New DataSource  and you will get Data Source configuration wizard ....

Select Next.. In the Data Source configuration wizard select New connection . And Add connection window appears. Choose the data source as Microsoft SQL server Compact 3.5(.NET Framework)
In here you can create a Database or you can browse existing database.So i choose browse because i use sample Northwind database.

After choose the Database click the Test Connection. If it tells Test Connection Succeed that means you successfully config the database.Otherwise it will show a error message.

After that click Next. In here you can select the tables that you want. For the demo i select Customers table and click finish. It will ask that you want to copy the database to your app and select yes.
Now you will get something like this
(Check solution explorer Northwind DB is there)

Now simply drag and drop Customer table that appear in Data sources to Form1. After that select grid properties(Right click grid-> Preperties )
In properties select Table styles and click the (...)

After you select it you will get this..

Click GridColumnStyles (...).. after that remove additional Members and keep Members you want.. Select OK

After that Select Generate Data Forms like this....

Finally you will get the form and MVS2008 automatically create two additional forms for you.

Click the debug button and you will get the output..

You can download Sample Project Application

Create a simple windows mobile application Using Microsoft Visual Studio 2008

In this article I'll teach you how to create a simple windows mobile application using MVS2008.
but first you have to install these softwares to develop mobile application.
Windows SDK
Windows DTK 

First launch MVS2008 and Select New -> Project.
Under the Visual C# project types you can see Smart Device. Just click it and select the Smart device Project. Add a name for your project and select OK.

after that Select Device Application in Device templates and click OK.

Now You will get something like this....

Simply Drag and Drop a Label,Textbox and Button to the design area and change name and text as follows.
Label  name - lblText , Text - null(empty space)
TextBox name - txtText
Button name - btnclick ,  Text - Click!

Now your form look like this...

Now double click the button and it will direct to the source code of the form. In the btnclick_Click() paste this code..
private void btnclick_Click(object sender, EventArgs e)
               lblText.Text = "Hi " + txtText.Text;
After that right click the project and select Build. If there are no errors it will say Build succeed.
Now click the debug button to get the output.

It takes little more time to compile and run the application. So you have to wait some time. After the application build you can check with sample inputs.

You can download Sample Project In here...

Read XML file from C# using Microsoft Visual Studio 2008

Topic says what i'm going to teach you.But first you need to know some theories about XML and C#.
  • System.Xml.XmlDocument class provides handling XML  
  • There are two main .NET APIs for working with XML
  1. XML document object model (DOM) - XmlReader and XmlWriter
  2. Tree Based XML handling
  • XML data loaded into memory.
  • Can search for any node.
What is XML DOM ?
  • It provide standard mechanism for programitically working with data.
Read XML data
  • XML data is load into XmlDocument object
  • So first we have to create a XmlDocument object .

XML data look like this...
  <book category="CHILDREN">
    <title>Harry Potter</title>
    <author>J K. Rowling</author>
  <book category="WEB">
    <title>Learning XML</title>
    <author>Erik T. Ray</author>

Contains root node and multiple child nodes (root node - bookstore)
Each node has the parent node (Except root node)
Each node can have siblings (Except root node).

So if you want to learn XML deeply just go to There are lot of tutorials available.

OK lets do this. Now we are going to make a new project in Microsoft visual studio 2008 to read a simple XML file.
First you need to launch Visual studio 2008 and Select new Project like this...

After that select Visual C# Windows Forms Application and Give a name to the project and save where ever you want...

Right Click the project and Select Add --> New Folder . Rename that folder into XML.

Right Click the XML folder that you create and Select Add -> New Item . Select XML file and name it as BookStore.xml and Click Add.

Copy and Paste this XML code into BookStore.xml file.

<?xml version="1.0" encoding="utf-8" ?>
  <book publicationdate="2000" ISBN="212">
    <author>Author 1</author>
  <book publicationdate="2009" ISBN="312">
    <title>Java for dummies</title>
    <author>Author 2</author>
  <book publicationdate="2008" ISBN="412">
    <author>Author 3</author>

 Now right click the Form1.cs and select view design . Create design like this and rename button name as btnLoad and Text as Load Data.
Also drag and drop a textbox and click the small arrow in the right upper corner and tick the multiline. Change the name as txtresult.

Double click the button and it will automatically direct to the code.
First you need  2 references and a varialble....

using System.Xml;
using System.IO;

 private string _xmlFile;

After that go to the design view and double click the Form1.cs and it will automatically go to code and create Form1_Load event.In the Form1_Load paste this code..
if (!SetxmlFilePath())
                MessageBox.Show("Unable to load  XML file.");
Now create the private bool SetxmlFilePath() method and paste this code inside that method..
FileInfo fi = new FileInfo(Application.StartupPath + @"\..\..\XML\BookStore.xml");
            if (fi.Exists)
                _xmlFile = fi.FullName;
                return false;
            return true;
 Now goto design area and click the Load button and you will get the btnLoad_click. Inside that paste this code..
Now Create private void DumpContents(string _xmlFile) mathod and paste this code inside that method..
           string publishDate = null;
            string title = null;
            string author = null;
            string ISBN = null;
            string price = null;
            XmlElement element = null;

            XmlDocument doc = new XmlDocument();

            foreach (System.Xml.XmlNode node in doc.SelectNodes("//book"))
                title = GetNodeValue(node, "title");
                author = GetNodeValue(node, "author");
                price = GetNodeValue(node, "price");

                element = (XmlElement)node;
                publishDate = element.GetAttribute("publicationdate");
                ISBN = element.GetAttribute("ISBN");

                DisplayBook(title, author, publishDate, ISBN, price);
Create this method..
private void DisplayBook(string title, string author, string publishDate, string ISBN, string price)
            string results = string.Format("{0} ({1}) by {2} (ISBN: {3}), ${4}",title, publishDate, author,
            ISBN, price);
After that create AddText methos like this..
private void AddText(string Text)
            txtResult.AppendText(Text + Environment.NewLine);
At last create this method to get the node value
 private string GetNodeValue(XmlNode parentNode, string nodeName)
            string retval = null;

            XmlNode node =parentNode.SelectSingleNode(nodeName);
            if (node != null)
                retval = node.InnerText;
            return retval;
 If you do it correctly right click the project and select build . If there any compilation error you have to fix it to get the result.
If there are no errors click the debug button , after the form shows click the Load Data button and the result textbox shows the xml file.

You can download the sample project