Tuesday, July 16, 2013

Palindrome Checking in C#



Here is a short code to do this:

       private string CheckPalinDrome(string text)
        {
            //Converting into Upper case and remove blank spaces in between
            text = textBox2.Text.ToUpper().Replace(" ", string.Empty);
            string revText = ReverseString(text);
            if (revText == text)
            {
               return("palindrome");
            }
            else
            {
                return ("Not palindrome");
            }
        }

        private string ReverseString(string s)
        {
            char[] arr = s.ToCharArray();
            Array.Reverse(arr);
            return new string(arr);
        }

Wednesday, July 3, 2013

How to set directory path for setup project in visual studio 2010


Here I am going to share how we can set directory path for our installed package.
Suppose you have a setup project already included in your main project. (To know how to add setup project in Visual Studio-2010, you may refer to article at:

http://www.c-sharpcorner.com/Blogs/9817/adding-a-setup-project-in-visual-studio-2010.aspx)








Now you want to set directory path for your install, so that your app get installed in the desired location. In order to do this, you need to follow steps as:

 1.Right Click on your Setup project -> View -> File System

 2.Then Click Application Folder, open property tab

 3.Set 'AlwaysCreate' property to TRUE.
  (This property creates a directory structure for your install, if directory structure doesn’t exist.)

 4.Then Set 'DeafultLocation' property to your desired location (e.g. C:\MyWinApps\).
 (You may choose any directory structure of your choice except some folders/Directories which are protected by Windows Operating System)