Tuesday, September 10, 2013

How to display original quality image in Crystal Reports

Step 1:
Open any crystal report
Step 2:
Go to Menu->Crystal Report->Design->Default Settings
Step 3:
Go to Reporting Tab and make sure "Retain Original Image Color Depth" is checked

Note: Try using images with no transpareny for good quality.

Sunday, September 8, 2013

What is the difference between Public, Private, Protected And Internal

Anywhere Same  class Derived Classes Same Assembly Derived Classes in
another assembly
Public




Private




Protected



Internal




Protected
internal



Saturday, September 7, 2013

How to reset / change user password programmatically using asp net membership

MembershipUser user = Membership.GetUser({UserId});
user.ChangePassword(user.ResetPassword(), {NewPassword});

How to restrict get; setter; to get only inside c# asp net classes

Lets say you have a get, set property inside a class say IP
public String IP { get; }
 
When I specify get only I wont be able to set the property even inside the class itself. e.g
this.IP = "127.0.0.1";
Property or indexer 'IP' cannot be assigned to -- it is readonly 
Solution, just type private keyword with set property like this
public String IP { getprivate set; }
All done

Wednesday, September 4, 2013

How to get first and last day of month asp net c#

First day of month
    public static DateTime GetFirstDayOfMonth(DateTime dt)
    {
        return new DateTime(dt.Year, dt.Month, 1);
    }
Last day of month
    public static DateTime GetLastDayOfMonth(DateTime dt)
    {
        return new DateTime(dt.Year, dt.Month, 1).AddMonths(1).AddDays(-1);
    }