You can insert a line feed / carriage return by inserting 'Chr(13)' in your selection formula in Crystal Report.For an example,StringVar textToDisplay := "Title for the Cross-Tab" + Chr(13) + "Period from Year X to Year Y"Happy Coding...
Tuesday, December 30, 2008
Thursday, December 25, 2008
C# array in descending or reverse order
How do you sort a C# array in descending or reverse order? A simple way is to sort the array in ascending order, then reverse it:int[] intArray = new int[] { 3, 1, 4, 5, 2 };Array.Sort<int>( intArray );Array.Reverse( intArray ); Of course, this is not efficient for large arrays.A better approach is to create a custom Comparer. Following is a nice generics class that will sort an array in descending order. Note that the object type must be comparable (inherit from IComparable) as any useful class should.Here’s a simple web application to...
Saturday, December 20, 2008
Design Pattern - Abstract Factory Pattern
Today I'm going to write about one of the most popular patterns in the design patterns world - the abstract factory.You can read my previous posts about design patterns here:Design PatternSingleton Design PatternAn abstract factory provides an interface for creating families of related objects without specifying their concrete classes.The abstract factory dictates which products the concrete factories will produce. Each concrete factory can build...
Design Pattern - Singleton
Before we move to Singleton pattern, first we should know what is instantiation and how it will play main role in Singleton.Please refer my previous post for basic information about Design Pattern if you needs.Instantiation means creating an object using a class as a template. There are two approaches to instantiation:Lazy instantiationEager instantiationLazy instantiation : a class is not instantiated until a request is made via the Singleton.Instance()...
Saturday, December 6, 2008
Highlight Datagrid or GridView row on mouse over in asp.net
To highlight the row and when mouse moves out, the style sheet is switched back to normal. Use the following two steps to solve this case. This will applicable for both Gridview and Datagrid controls.Step 1 : Create styles for normal and highlight view of the row.<style type="text/css">.normalrow{ background-color:white;}.hightlighrow{ background-color:#cccccc;}</style>Step 2 : Now add handler for RowCreated event for the grid and add the attributes for onmouseover and onmouseout javascript events.Following...
Friday, December 5, 2008
Allow only numbers / digits in TextBox.
Allow only numbers/digits in TextBox. How to use Javascript to allow only numbers to be entered in a textbox. This is useful for phone numbers, ZipCode, and etc., Use the following two step to solve this situation. This solution works in both IE and Netscape/Mozilla. Step 1: Add the following javascript into you page.function AllowNumbersOnly(evt){ // Allow numbers only in the Textbox. var e = event evt; // for trans-browser compatibility var charCode = e.which e.keyCode; if (charCode > 31 && (charCode < 48 charCode...
Sunday, November 30, 2008
OOPs FAQ in C# - Part II
What is an Object? An object is an instance of a class. It can be uniquely identified by its name and it defines a state which is represented by the values of its attributes at a particular time. An object can be considered a "thing" that can perform a set of activities. The set of activities that the object performs defines the object's behavior. The state of the object changes according to the methods which are applied to it. We refer to these possible sequences of state changes as the behavior of the object. So the behavior of an object is defined...
OOPs FAQ in C# - Part I
What is the difference between indexers and properties in C#? Comparison Between Properties and IndexersIndexers are similar to properties. Except for the differences shown in the following , all of the rules defined for property accessors apply to indexer accessors as well. PropertiesIdentified by its name.Accessed through a simple name or a member access.Can be a static or an instance member.A get accessor of a property has no parameters.A set accessor of a property contains the implicit value parameter. Indexers Identified by its signature.Accessed...
.Net Remoting Interview Questions
What is .NET Remoting?Net remoting replaces DCOM. Web Services that uses remoting can run in any Application type i.e. Console Application, Windows Form Applications, Window Services etc. In CLR Object Remoting we can call objects across network..NET Remoting Architecture?Methods that will be called from the client are implemented in a remote object class. Client uses a proxy to call a remote object. Remote objects runs inside a process that is different from the client process For the client, the proxy looks like the real object with the same...
Types of Parameters in C#
In C#, parameters are means of passing values to a method. There are four different ways of passing parameters to a method in C#. The four different types of parameters areValueOutRefParams1.Value parametersThis is the default parameter type in C#. If the parameter does not have any modifier it is "value" parameter by default. When we use "value" parameters the actual value is passed to the function, which means changes made to the parameter is local to the function and is not passed back to the calling part.using System;class ParameterTest{static...
Tuesday, November 11, 2008
SQL Interview Tips - 1
What is data integrity? Data integrity is an important feature in SQL Server. When used properly, it ensures that data is accurate, correct, and valid. also acts as a trap for otherwise undetectable bugs within applications.Explain constraints?Candidate key :A candidate key is a combination of attributes that can be uniquely used to identify a database record without any extraneous data. Each table may have one or more candidate keys. One of these candidate keys is selected as the table primary key.Primary Key :Primary key will create column data...
Saturday, October 11, 2008
Setting a Default Browser for Visual Studio 2005/2008
Setting a Default Browser for Visual Studio 2005/2008 :Right click on a .aspx page in your solution explorer Select the "browse with" context menu option In the dialog you can select or add a browser. If you want Firefox in the list, click "add" and point to the firefox.exe filename Click the "Set as Default" button to make this the default browser when you run any page on the site. Happy programming...