Friday, December 14, 2012

Send Email to Disk

Sometimes you need to check email sending locally and since you cannot send it over the network so there is a way to send your emails to you hard drive.

I am going to provide the Web.config settings which have been required to send email to local disk. Below are the setting which you can copy and paste in  Web.config:

<configuration>
<system.net>
<mailSettings>
<smtp deliveryMethod="SpecifiedPickupDirectory"
from="sender@mailserver.com">
<specifiedPickupDirectory pickupDirectoryLocation="C:\EmailFolder" />
</smtp>
</mailSettings>
</system.net>
</configuration>

This will create .eml Emails files to the specified folder (here, C:\EmailFolder), which
must already exist. If you double-click .eml email files in Windows Explorer,
they’ll open in Outlook Express or Windows Mail.

Hope this will help.


Thursday, December 13, 2012

SQL: Setting Value to Column with NULL values

Here is the structure of how to update a table column which has NULL values in it.

UPDATE TableName SET ColumnName = NewValue where ColumnName Is Null

Now lets apply it against a real scenario.

update Student set IsAdded = 0 where IsAdded Is Null

After executing this query all the values for the column IsAdded gets to 0 where it has NULL values.

Hope you have got the idea.


SQL: Set Default Value for a Column

Below is the structure for setting the default value for a column.  You will not face NULL values in the columns where this constraint gets added.

ALTER TABLE TableName
ADD CONSTRAINT
ADDED DEFAULT DefaultValue FOR ColumnName

Now lets apply it with a table so you will get more idea of how to work with it.


ALTER TABLE Student
ADD CONSTRAINT
ADDED DEFAULT 0 FOR IsAdded

Hope you have got the idea.

Wednesday, November 14, 2012

MVC 2 with Example

In this post I am going to discuss about the MVC 2.

MVC stands for Model, View, Controller.
Call hirarchy works in this way that when a request is sent then it calls the Controller function. Controller interacts with View and Model and after all the rendering Controller returns back response in Html form.

I will discuss MVC completely in some other post but currently I am going to discuss on MVC 2 project.

 Step 1: Creating MVC 2 Project:

I have used Visual Studio 2010 to create this MVC 2 project. Most of you may know of how to create a New Project in Visual Studio but if some one dont know then I have shown the screen below telling how to create a New Project.
You only need to goto File menu option and click on New from drop down menu and click on Project sub menu option.



Step 2: New Project Form:

After the above step you will get this New Project form gets appear in Visual Studio.
In Visual C# Installed Templates category select the Web category option and you will be shown a list of projects in this category. In this list you will see ASP.Net MVC 2 Web Application project option also.
Click on this option.
Give the name of project and change the default path for project saving location and also change the Solution Name if required else you can start with the default settings.
Click OK button.


Step 3: Unit Test Optional Project:

MVC project asks you to create a project for Unit testing also. Although its a very nice approach and you must follow it but since we are only going to exaplain about MVC 2 in this post so I have not created the Unit test project and selected No option.
Hope I will post the article for Unit testing project also.



 Step 4: MVC 2 Project Loaded:

Now you can see that our project gets loaded in Visual Studio with default settings.
You can see the hirarchy of the MVC 2 project in Solution Explorer.
Also I have opened HomeController.cs class.
If you want to see whether your project is building and running fine then you can click on the project Debug option which I have pointed out using arrow.


 Step 5: Running Project in Browser:

After running the MVC 2 project with default settings you can see that the project gets loaded in web browser. Visual Studio 2010 comes with a default ASP.Net Development Server and you dont need to configure the site on IIS.
So here in the screen shot you will be shown the default Home page for the site.


Step 6: Home Controller Index and About Action Results:

Since you know that MVC depends upon Model, Views and Controllers.
Here in the screen shot you can see a controller file named HomeController.cs.
Its a convention to postfix Controller keyword with each controller class.
Its a convention to postfix Model with each model class.
All the controller classes inherit from the Controller class which is included in System.Web.Mvc liabrary.
ActionResult is the return type of the controller function since every controller returns a View or a Json result. So in the screen below you can see the Index and About controller functions returns Views.


Step 7: Controllers and Views Relationship:

Against all the Controller functions returning ActionResult have a View associated with them.
In below screen you can see the Index and About Views in Home folder which is the name of the Controller.
So Controller functions always maps over Views. Thats might seems a bit different since in traditional ASP.Net project this is not the case.


Step 8: Option to Load View From Controller:

In order to go to View you can right click on the Controller function and you will be shown the "Go to View" option.
When you click on this option you will be moved to respective View automatically.


Step 9: Index View:

After following the above step you have been moved to the Index View which can be seen in the below screen.
 

Step 10: Creating New Controller named Contact:

Till then what we have seen is the deault settings which we see in the MVC 2 project when it gets loaded. Now in the next steps we are going to add a new controller function and then see how to add a view for it.
In the below screen you can see we have created a Controller function named "Contact" and its returning a View.


Step 11: Creating a View for the Controller:

Now lets create View for this Controller function.
Right click on the New Controller function and you will be shown the "Add View..." option.
Click on it and you will be seen a dialog.


 Step 12: Adding View for Controller:

After following the above step you have been shown a dialog for "Add View". You can change the name of the View but its better to keep the default name to keep the things easy to remember and its a good convention.
Check the Master page option since all the Views in this example are inheriting from Site.Master page.
Click on Add button.


Step 13: View Created for Controller:

Now after following the above step you can see.
A new View by the name "Contact.aspx" gets added to the Home folder in Solution Explorer.
So you can see that for the Home Controller the View also gets added to Home View folder automatically thats a great beauty of MVC.
We have opened up "Contact.aspx" page and you can look it in the center part of the Window.


Hope you have found this post useful. I have discussed the basics only since its a startup turorial on MVC 2.
I will also post on Advance topics of MVC soon.








SQL: Remove Column from Table

Here is the format which can be used to remove one or more columns from an already existing table:

ALTER TABLE table-name
DROP COLUMN column-name


Now lets implement it with a table Student which have following fields:

ID,
First Name,
Last Name,
Middle Name,
Address

Lets say we want to remove Middle Name

So we will use the following query:

ALTER TABLE Student
DROP COLUMN Middle Name



Hope you have got the idea how to delete the columns from an existing table.



SQL: Add Multiple Columns in Table

Here  is the statement skeleton for adding new column in an existing table.

ALTER TABLE table_name
ADD column_name1 datatype
ADD column_name2 datatype
ADD column_name3 datatype
.................................................
.................................................
.................................................
ADD column_nameN datatype


Lets explain it using an example:

Lets suppose I have a table Student and I want to add new columns int it then I will write the query like this.

ALTER TABLE Student
ADD CourseName varchar(50)
ADD Address varchar(100)
ADD SemesterNo int
ADD PassingOutYear DateTime


So all these columns gets added to the table.



Monday, October 22, 2012

SQL: Remove Multiple Columns from Table

Here is the format which can be used to remove one or more columns from an already existing table:

ALTER TABLE table-name
DROP COLUMN column-name1,
DROP COLUMN column-name2,
DROP COLUMN coloumn-name3

Now lets implement it with a table Student which have following fields:

ID,
First Name,
Last Name,
Middle Name,
Address

Lets say we want to remove Middle Name

So we will use the following query:

ALTER TABLE Student
DROP COLUMN Middle Name


Lets say we want to delete both Middle Name and Address then we use this query:

ALTER TABLE Student
DROP COLUMN Middle Name,
DROP COLUMN Address

Hope you have got the idea how to delete the columns from an existing table.



 

SQL: Create Table

Creating a Table using SQL script is quiete easy. Below is the format using which you can create a Table:

CREATE TABLE table_name
(
column-name1 data-type,
column-name2 data-type,
column-name3 data-type,
column-name4 data-type,
column-name5 data-type,
)

Now lets create a sample table names Student using this format:

CREATE TABLE Student
(
ID int,
First Name varchar(50),
Last Name varchar(50),
Middle Name varchar(50),
Father Name varchar(50),
Address varchar(255),
DateOfBirth datetime
)

So its easier to create any table following this template.


ASP.Net MVC 4 Download

Here is the link for downloading ASP.Net MVC 4 download to work on MVC 4 projects using Visual Studio 2010.

http://www.microsoft.com/en-pk/download/details.aspx?id=30683
File Size : 36  MB

Download and install.

After installation you will get the MVC 4 project option in the Project Type Selection Form when you go for creating New Web Project.

Saturday, October 13, 2012

SQL: Add Column in Table

Here  is the statement skeleton for adding new column in an existing table.

ALTER TABLE table_name
ADD column_name datatype

Lets explain it using an example:

Lets suppose I have a table Student and I want to add new column in it named CourseName.

ALTER TABLE Student
ADD CourseName varchar(50)

A new column gets added to the Student table.

Saturday, October 6, 2012

SQL: String or binary data would be truncated

 Sometimes when you write insert or update query and if get this type of exception:
 
"String or binary data would be truncated. The statement has been terminated."

Dont worry I am going to tell you the solution for this.

This error occurs only when you have a table field that is not big enough to store the data you are inserting in the field.

Example:
Let say you have a table Student with following fields:
ID int
Name varchar(10)

Let say we are going to insert a record in this Table using following query:
insert into Student (ID, Name) 
Values(1, "Name with More Than 10 Characters")

If you execute this query you get the above discussed error since the field Name in Student table has capacity for 10 characters only and you are trying to insert a value which is more than 10 characters.

Solution:
There are two solutions for this:

1. Increase the Field capacity big enough to store the values in database.

2. You can truncate the string value which you have been inserting to fit the field capacity in database. I am going to use the above example again with little change:

insert into Student (ID,Name)
Values (1,cast('Name with More Than 10 Characters' as varchar(10)))

The issue with this solution is that the value that gets stored in database will be only 10 characters:
"Name with  "

So its upto you how you want to handle your problem using any of the solution.

 

 
 

Wednesday, October 3, 2012

Application: MPZ File Copier

I have developed a File Copier Application which is a Desktop Application and it has the following features:
  1. Folder to Folder Copying
  2. Folder to Partition Copying
  3. Partition to Partition Copying
  4. Destination Change Option if Less Space on Disk
  5. Option to Copy Data with Less Disk Space
  6. System Shutdown option after Copying Process
  7. Installer for installing the Application
Operating System Support:
- Windows 2000
- Windows XP
- Windows Vista
- Windows 7
- Windows Server 2000, 2003, 2007

 Here is the download Link to download:

MPZ File Copier Download

I need your suggestions for more features and report any errors if found on below email address:
myprogrammingzone@gmail.com


Thursday, September 27, 2012

SQL: Restore Database Error

Sometime it happens that if you try to restore the database backup then you get this kind of error:

// ***************************************************************************
TITLE: Microsoft SQL Server Management Studio Express
------------------------------

Restore failed for Server 'MY-PC\SQLEXPRESS'.  (Microsoft.SqlServer.Express.Smo)

For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=9.00.3042.00&EvtSrc=Microsoft.SqlServer.Management.Smo.ExceptionTemplates.FailedOperationExceptionText&EvtID=Restore+Server&LinkId=20476

------------------------------
ADDITIONAL INFORMATION:

System.Data.SqlClient.SqlError: The operating system returned the error '5(Access is denied.)' while attempting 'RestoreContainer::ValidateTargetForCreation' on 'c:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\testdb.mdf'. (Microsoft.SqlServer.Express.Smo)

For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=9.00.3042.00&LinkId=20476

------------------------------
BUTTONS:

OK
------------------------------

//********************************************************************************

Don't worry at all I am going to tell you how to resolve this issue using screen shot.

Just see below screen shot and you will get to know how to do it.

Step 1: Restore Database Window:




Step 2: Restore Database Error


Step 3: Restore Database Error Fixing:


In the above screen shot change the paths for the MDF and LDF file with following location:
C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\testdb.mdf
C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\testdb.ldf

Click OK and your database will get restore successfully.


Friday, September 14, 2012

Tool: SQL Prettry Printer

People who are students or related to programming field may some time need to work with SQL or MySQL databases. As you know when you have to work with queries then sometimes it becomes very difficult to understand a query due to bad formatting.

I am sharing a tool which makes your life easier and I also got a lot of benefit from it.

http://www.dpriver.com/dlaction.php

Above is the download link.

Below is the example which I have taken from dpdriver.com website.


SELECT   i.obj#,
         i.samplesize,
         i.dataobj#,
         Nvl(i.spare1,i.intcols),
         i.spare6,
         DECODE(i.pctthres$,NULL,NULL,
                            Mod(Trunc(i.pctthres$ / 256),256)),
         ist.cachedblk,
         ist.cachehit,
         ist.logicalread
FROM     ind$ i,
         ind_stats$ ist,
         (SELECT   enabled,
                   MIN(cols) unicols,
                   MIN(To_number(Bitand(defer,1))) deferrable#,
                   MIN(To_number(Bitand(defer,4))) valid#
          FROM     cdef$
          WHERE    obj# = :1
                   AND enabled > 1
          GROUP BY enabled) c
WHERE    i.obj# = c.enabled (+) 
         AND i.obj# = ist.obj# (+) 
         AND i.bo# = :1
ORDER BY i.obj# 

The original query is written below which I have formatted using SQL Pretty Printer tool.

select i.obj#,i.samplesize,i
.dataobj#,nvl(
i.spare1,i.intcols),i.spare6,dec
ode(i.pctthres$,null,null,mod(trunc(i.pctthres$/25
6),256)),ist.cachedblk,ist.cachehit,ist.logicalrea
d from ind$ i, ind_stats$ ist, (select enabled, mi
n(cols) unicols,min(to_number(bitand(defer,1))) de
ferrable#,min(to_number(bitand(defer,4))) valid# f
rom cdef$ where obj#=:1 and enabled > 1 group by e
nabled) c where i.obj#=c.enabled(+) and i.obj# = i
st.obj#(+) and i.bo#=:1 order by i.obj#

Hope you will like this tool and your databases queries becomes easier to understand. Please share some other tool if you know and I will surely add it on the blog.

Website: Color Combination Website

I want to share a site which I have used myself for getting color combinations based on a background color. Hope its really helpful for others also.

http://www.cs.brown.edu/cgi-bin/colorcomb

If anybody can provide a better website which is providing nice color combinations then let me know.

Monday, September 10, 2012

CSS: Margin

CSS Margin:
Margin is the distance from neighboring elements. Padding and Margin are nearly the same. Padding is for a single element and related to element itself while margin is related to other elements or controls around another control.
Example:
I am creating a div having a border and then put up an paragraph inside it and apply margin on it. This example will make you understand the margin concept very well.

The code that I have used along with setting margin on Left button is given below:
        
Hope you have got the idea of margin well. Your suggestions for improvements will be highly appreciated.

Sunday, September 9, 2012

CSS: Padding

Padding is the space between an element border and the content inside it.
Example1:


Button having padding 15 from top, right, left and bottom.

    // myprogrammingzone code
        
        

            Button having padding 15 from top, right, left and bottom.
    // myprogrammingzone code
    
Example 2:


Button having padding-top: 10px; padding-right: 20px; padding-bottom: 30px; padding-left: 40px;

    // myprogrammingzone code
    
        Button having padding-top: 10px; padding-right: 20px; padding-bottom: 30px; padding-left:
        40px;
    // myprogrammingzone code
    

Example 3:
    
    


Button having padding-top: 10px; padding-right: 20; padding-bottom: 30px; padding-left: 40px;

    // myprogrammingzone code
    
        Button having padding-top: 10px; padding-right: 20px; padding-bottom: 30px; padding-left: 40px;
    // myprogrammingzone code
    
There are four forms in which padding can be set which are explained below:
padding:10px 20px 30px 40px;
        padding-top: 10px
        padding-right: 20px
        padding-bottom: 30px
        padding-left: 40px;
    
padding:10px 20px 30px;
        padding-top: 10px
        padding-right: 20px
        padding-bottom: 30px
        padding-left: 20px;
    

padding:10px 20px;
        padding-top: 10px
        padding-right: 20px
        padding-bottom: 10px
        padding-left: 20px;
    

padding:10px;
        padding-top: 10px
        padding-right: 10px
        padding-bottom: 10px
        padding-left: 10px;
    

Hope you will get the idea for padding very well.

Saturday, September 8, 2012

Javascript: Set Label Text


In this post I am going to give an example of how to set a label text using Javascript.




Below is the code that I have used to set the label text.


    // myprogrammingzone code
    
    
    
    // myprogrammingzone code
    


Javascript: Date Object

Date Object
Date object is used to manipulate date and time.
There are four different constructors that can be used to instantiate a Date.

var d = new Date();
var d = new Date(milliseconds);
var d = new Date(dateString);
var d = new Date(year, month, day, hours, minutes, seconds, milliseconds); 

To return todays date and Time you can use the first Line of code.



The code that has been used to create and show date and time will be shown below:
// myprogrammingzone code


// myprogrammingzone code

Hope this will help you understand the basics of Date objects.


Javascript: Popup Making Tool


Make a Popup Window
In this post I am going to provide a tool for creating a Popup Window. This tool will also give you the code that you can use in your sites and you can test the Popup Live and when you are satisfied then copy the code and then paste it in the click event of either button or link or at any other event you want it to use.


Scrollbars
Location
Toolbar
Menu Bar
FullScreen
Dependent
Directories
Resizable

Top:

Left:

Width:

Height:



Test Popup with Current Settings




Hope you will enjoy the post and it will be a useful tool for you.


Friday, September 7, 2012

Javascript: Popup Window

In this post I am going to give an example of Popup Window creation using Javascript function call.



Below is the javascript function that has been used to create this Popup.
// myprogrammingzone code


// myprogrammingzone code


Its a simple example to create a Popup Window using Javascript. Give me suggestions for improvement.

Thursday, September 6, 2012

Javascript: Alert, Prompt and Confirm Message Boxes

You may have seen a lot of web sites which display popup messages or message boxes. That's really simple do that. In this post I am going to tell you how to create a message box and will give an example to test the code I will  provide as well.

Javascript Alert Box Example:
Click the below button and a alert box will be shown on website.


Below I have given the code that I have used to display a message box on the site. I have used javascript which you may be familiar with. I have written a javascript function and then called that function on the click event of the button.

// myprogrammingzone code



// myprogrammingzone code


Javascript Prompt Message Box:
Click the below button and a prompt message box will be shown on website.


Below I have given the code that I have used to display a message box on the site. I have used javascript which you may be familiar with. I have written a javascript function and then called that function on the click event of the button.

// myprogrammingzone code



// myprogrammingzone code


Javascript Confirm Message Box Example:
Click the below button and a alert box will be shown on website.


Below I have given the code that I have used to display a message box on the site. I have used javascript which you may be familiar with. I have written a javascript function and then called that function on the click event of the button.


// myprogrammingzone code



// myprogrammingzone code

Hope you have enjoyed this post. Send me suggestions to improve it.

HTML: Fixed Size and Resizable Text Area

Text Area are mostly used for data entry in web forms. They could be resizable on run-time and can also be created with fixed size having particular width and height.

Resizable Text Area:

Below I am showing a Resizable text area and its respective code which I have used to create it.

Below is the html code that has been used to create Resizable text area.
// text area code

// text area code

Fixed Size Text Area:

Now next I am going to show an example of fixed size Text Area.


Here is the html source used to create Fixed Size Text Area:
// text area code

// text area code

Hope you will found this post useful. Send suggestions for improvement.

Wednesday, September 5, 2012

Regular Expressions

Regular Expressions is an important part of development. Although it seems simple but to write complex regular expressions is very difficult task. Regular Expression are used to validate data against it and also used for pattern matching and for searching and replacing of strings.

I am providing a facility here by which you can validate expressions also.


Regular Expression: Test String:

Result:


Below are the list of characters which are used in Regular Expressions for creating Regular Expressions.

Wildcard Character Description
* Zero or more occurrences of the previous character or sub-expression.

For Example:
PREV*included

Matched:
included
PREVincluded

Not Matched:
PREVPREVincluded
(Although Description says sub-expression could occur multiple time but actually it can occur only single time like in below example.)

Second Example:
a*included

Matched:
included
aincluded
aaincluded
aaaincluded

Not Matched:
abincluded
aacincluded
aaabhdgincluded

+
One or more occurrences of the previous character or sub-expression.

For Example:
PREV+included

Matched:
PREVincluded

Not Matched:
included

PREVPREVincluded
(Although Description says sub-expression could occur multiple times but actually it can occur only single time like in below example.)


Second Example:
a+included

Matched:
aincluded
aaincluded
aaaincluded

Not Matched:
included
aacincluded
aaabhdgincluded


()
Groups a sub-expression that will be treated as a single element.

For Example:
(SingleElement)+

Matched:

SingleElement
SingleElementSingleElement
SingleElementSingleElementSingleElement
SingleElementSingleElementSingleElementSingleElement
and many more like above.
| Its same like OR operator which takes two operands and match any one operand or both.

For Example:
First|Second

Matched:
First
Second

Second Example:
http|www|ftp

Matched:
http
httpwww
httpwwwftp
httpftpwww

{}
Matches one character in a range of valid characters.

For Example:
[A-D]

Matched:
A
ABCD
AF
B12

Not Matched:
NF
KJ
12
12
$#

[^]
Matches a character that isn’t in the given range.

For Example:
[^A-C]

Matched:
D
D1
123abc
abc
and many more like above.

Not Matched:
A
B
C


.
Any character except newline means instead of dot (.) character you can use any character but you cannot find matches in multiple lines.

For Example:
.word

Matched:
aword
bword
Aword
1word
#word
and many more like above.

Not Matched:
word
abword
12word
AB12dvfword
#$word

Could not match in multiple lines.

\s
Any white-space character (such as a Tab or Space).

For Example:
Space Character
Tab Character
New Line Character
Carriage Return
Form Feed Character
Vertical Tab Character


\S
Any non white-space character.

For Example:

Matched:
Any alphanumeric or special character

Not Matched:
Space Character
Tab Character
New Line Character
Carriage Return
Form Feed Character
Vertical Tab Character


\d
Any digit character.

For Example:
\d

Matched:
Match any character from 0-9

Not Matched:
Any alphabetic character or special character.


\D
Any character that isn’t a digit.

For Example:
\D

Matced:
Match any alphabetic or special character.

Not Matched:
Any character from 0-9


\w
Any “word” character (letter, number, or underscore).

For Example:
\w

Matched:
A-Z, a-z, 0-9 or underscore

Not Matched:
Special characters except underscore.



\W
Any non word character.

For Example:
\W

Matched:
%
$
#
any other character which are not in Not Matched category below.

Not Matched:
A-Z, a-z, 0-9


Hope you have found the post useful. I am grateful for your positive feedback to improve.


Sunday, September 2, 2012

Visual Studio Setup and Deployment Project

I am writing this post to create Setup and Deployment Project in Visual Studio 2005. Hope this will be really helpful for those who are creating such project for the first time. The steps followed in this project is nearly same both for Windows Desktop Applications projects and for Web Application Projects.

Step 1 (Setup Project Initial Step):
First of all there should be a Windows Project or Web Project for which Setup Project is needed to be created.
Its not necessary that you should load your project in Visual Studio for which you want to create installer.
In current example I have loaded a previous project which is a Windows Application  for which I will create a setup project. You can see WindowsApplication5 Project loaded in Visual Studio.





Step 2 (Creating a Setup Project):
Right click on the Solution Project and select New Project option from Add option sub menu.




Step 3 (Selecting Project Type):
Below is the Add New Project form.
Select Setup and Deployment from Other Project Types.
From the templates section select Setup Project template.
Enter the name for Setup project if you want.
Select the location if you want to change the default location for saving the project files.
Click OK.


Step 4 (Setup Project Loaded in Solution Explorer):
In below screen you can see that a Setup project gets added in Solution Explorer by the name Setup1.
On the Left Window File System Window is highlighted which is an option for Setting folder options in Setup Project.



Step 5 (Add Project Output):
Next we need the Output for our project for which we are creating setup.
Right click and Select Project Output option from Add option sub menu.




Step 6 ( Add Project Output):
Below you can see the Add Project Output form in which you need to select the Primary Output and from Project option you select the application for which setup is required.
Click OK.




Step 7 (Project Output Added to Setup Project):
In below  screen you can see the Project Output gets added to the Setup Project.




Step 8 (File System Settings for Setup):
Right click on Setup Project and select File System option from View sub menu.
On the left window you will see File System Window will appear. Here you have three folders for which we set few settings that are optional.
First is adding any extra files like help files to be added in Application Folder.
Second is adding Shortcut to Desktop for the Application.
Third is adding Shortcut to Programs menu for Application.




Step 9 ( Adding Shortcut on Desktop or Programs Menu):
Right click on Users Desktop Folder in File System Window or the Users Programs Menu if you want to add shortcut to any of them or both.
Next Right click in the Right Window and select Create New Shortcut option.




Step 10 (Select Item in Project):
Since you have application in Application Folder double click Application Folder.


Step 11 (Select Application Output):
Select Application Output for which we want to create shortcut from the Application Folder.
Click OK.



Step 12 (Shortcut Added):
In below screen that after the above step gets complete the Shortcut gets added to the Right Window.




Step 13 (Building the Setup Project):
Next we need to Rebuild or Build the Project  after Right clicking on Setup Project.



Step 14 (Installing Setup):
For installing the setup Right click on the Setup Project and click Install.
For uninstalling the Setup Right click on the Setup Project and click Uninstall.




Step 15 (Setup Project Installation):
Here our Setup got run and we can follow the installation Steps and out application gets installed on the System.



This is a long post may be I have skipped some thing since I have to give a basic understanding of how to create a setup project. Give me comments if you need any improvement.

Visual Studio 2005 Smart Phone Project

In this post I am going to create a Smart Device Application using Visual Studio 2005.

If you need an Overview of Visual Studio 2005 then you may found this post useful:
Visual Studio 2005 Window Application Project

Step 1 (Open Up Visual Studio 2005):
First of all open up Visual Studio 2005 from Programs menu. Select the Project option from New Sub Menu in File Menu.


Step 2 (Select Project Type):
In New Project Window select the Smart Phone 2003 option from Smart Device Category.
From the templates select the Device Application (1.0) option.
Set the Name of the Project if you want.
Set the Location where to save project files if you want to change default location.
Set the Solution Name if you want.
Click OK.


Step 3 (Smart Phone 2003 Application Project Loaded):
Now you can see in the below screen that the project gets loaded. I have set few things.
I have added a Label on the Form.
I have set its Text property to My Smart Phone.
I have highlighted the Solution Explorer which contains all the files that are contained in project.
At last I have clicked Debug option.

(Note: When you build the application you may get the error that .Net Framework 1.1 is required. You can select the Upgrade Project Option from Project menu.)


Step 4 (Select Deployment Device):
When I pressed Debug then a Dialog gets open which will ask me to select the device on which I want to deploy my project application. Since I don't have Windows CE device therefore I have select the third option of Pocket PC 2003 SE Square Simulator. There are many other options which you can also select.


Step 5 (Smart Phone Application Deployed on Pocket PC Emulator):
Here in below screen you can see that our application gets deployed to Pocket PC 2003 emulator.


Hope you found this post useful if you want to improve it then give me suggestions.

Saturday, September 1, 2012

Pocket PC Project in Visual Studio 2005

In this post I am going to create a Pocket PC2003 Project in Visual Studio 2005.

To get an overview of Visual Studio 2005 you can visit my previous post on below link:
Visual Studio 2005 Window Application Project

Step 1 (Open Visual Studio 2005):
Open Visual Studio 2005 from Programs menu and then click File menu option and select Project option from New Sub menu.




Step 2 (Visual Studio 2005 Pocket PC 2003 Project):
New Project window gets shown. Click on Smart Device Project Type which contains Pocket PC 2003 option, click on it and select Device Application option from the Templates. You can change the default Name of Project, Location and Solution Name and then click OK.



Step 3 (Pocket PC 2003 Project):
Project gets loaded in Visual Studio and you can see the below screen shot which contains the Solution Explorer containing files used in project. I have added a Button from Toolbox to the default form on Pocket PC and names it  Show Message on Click. I have added a click event for this Button and added following code in it.

private void button1_Click(object sender, EventArgs e)
{
     MessageBox.Show("Button Click Message.");
}


I have changed Button Text using Properties Window Text Property which I have highlighted.



Step 4 (Deploy Pocket PC Application on Simulator):
Next click on Debug button in Menu bar which loads the following Window asking for selecting the Device on which to deploy and test the application. Currently I have select the Second option. If you have a Pocket PC then you can connect it with your PC and can select the first option. The other three options below second option could also be selected if you don't have Pocket PC..



Step 5 (Pocket PC Application Deployed):
Here you can see your applications gets deployed to Pocket PC 2003 emulator.




Step 6 (Application Button Click):
Click on the button shown in Application Show Message on Click. When you click it the click event we have written for it will be called and a message box gets displayed inside the emulator.


Hope you have enjoyed this post. I really appreciate your participation to make this post better.

Visual Studio 2005 Window Application Project

I am creating a Visual Studio 2005 project. This post will be for the absolute beginners who are not familiar with the Visual Studio environment and how to create the project.

Microsoft has provided best Integrated Development Environments which are easier to learn and programmers love to work with the tools they have provided.

Microsoft has provided the free versions for Visual Studio and currently Visual Studio 2012 is going to be launched which will be hope so more better then its previous version Visual Studio 2010.

Visual Studio Express editions are free to download and develop desktop and web applications.

Check below links for downloading Visual Studio different versions:

Visual Studio 2005 
Visual Studio is launched in 2005.
Visual Studio 2008 
Visual Studio 2008 is launched in 2008.
Visual Studio 2010 
Visual Studio 2010 is launched in 2010.
Visual Studio 2012 
Visual Studio 2012 is launched in 2012.


Step 1 (Open Visual Studio 2005):
Open Visual Studio 2005 using Programs menu. The initial form that gets loaded after Visual Studio 2005 gets open. Below is the screen shot for Visual Studio 2005 Start Page.



Step 2 (Create New Project):
To create a New Project in Visual Studio 2005 click on File menu and select Project option from New sub menu as shown in screen below. You can also use short cut key Ctrl+Shift+N.




Step 3 (New Project Creation Dialog):
When a New Project option is selected then a New Project form gets loaded which show the different Project Types which can be created in Visual Studio 2005 along with the templates within each Project Type. I have highlighted all the parts contained in New Project form.


Step 4 (New Project in Visual Studio):
Below is the default project screen which gets loaded in Visual Studio 2005. I have added few changes to complete my example. Like I have added a Label from Toolbox which I have highlighted in the below screen. I have also highlighted the Solution Explorer portion which contains all the files contained in the project. Below it is the Properties Panel which is showing properties for the Label on the form having text My First Window Application. In the menu portion I have highlighted the Debug button to debug and Run the project. I have shown a form which gets loaded after I clicked on this Debug button.




Step 5 (Debug and Run Project):
In the above screen shot I have highlighted the Debug menu button. When I clicked on it then project gets build first and then it got Run and our application gets loaded as shown in form below which is the only form contained in our application. Its same concept like Index page in Websites.




Download Visual Studio 2012

From Microsoft.com:
  • Visual Studio 2012 Express:

     

    Hardware Requirements

    • 1.6 GHz or faster processor
    • 1 GB of RAM (1.5 GB if running on a virtual machine)
    • 4 GB of available hard disk space
    • 100 MB of available hard disk space (language pack)
    • 5400 RPM hard drive
    • DirectX 9-capable video card running at 1024 x 768 or higher display resolution

     Supported Operating Systems

    • Windows 7 SP1 (x86 and x64)
    • Windows 8 (x86 and x64)
    • Windows Server 2008 R2 SP1 (x64)
    • Windows Server 2012 (x64)

    Supported Architectures

    • 32-bit (x86)
    • 64-bit (x64)

    http://go.microsoft.com/?linkid=9810172

    Download Microsoft Visual Studio 2005

    From Microsoft.com:
    From Amazon.com:
    • Microsoft Visual Studio Professional 2005: