Saturday, September 13, 2014

Hello Everyone.
Bulk W-APP software.

I also have a Wapp contacts filter which can filter million of mobile number and show you which numbers are available on what-s-app. You can even see their what-s-app status & last online time.

Let me know if anyone out there is interested in these software

You can see video demonstration of these apps from below links:-

My email address is
Skype - gahlotkrishan
Website -

Thank you

Monday, September 1, 2014

Hi friends,

I've created a nice analog clock in c# for your desktop.

You can download from here

I'll post the source code very soon.
Thank you.

Monday, November 12, 2012

Hello Friends... First of all wishing u all a very happy and prosperous DEEPAWALI ... 
Sorry for not being in touch for a long time as I'm having very tight schedule in office.
OK m not bothering anymore let's come to the point, some times we need to get values from a textbox separated by certain delimiters like "krishan; manish; rahul, dinesh" in this string names are separated by ';' and ',' characters. What we need to get - all names stored in an array or in a dropdown/combobox.

Another example could be getting distinct mobile numbers from a textbox separated by delimiters.
To achieve the same we can use Linq and some predefined string functions.

Step 1: Create a character array of delimiters

Step 2: Separate textBox text using Split() function of string class and hold them in string array

Step 3: Filter the string array using LINQ to get only those number having length=10

Step 4: Remove duplicate numbers using LINQ's Distinct() function

Step 5: Now insert the valid numbers in combobox
Final: Full code...

Cheers ... Download Source Code From Here

Saturday, October 13, 2012

In my earlier post I demonstrate how you can insert smiley images in richtextbox when a user types the corresponding emotion code.

Now let me show how you can easily do the same in with simple javascript code.
  • First of all download some smiley images and paste them in your website's root folder
  • Put a div element inside your aspx page with contentEditable property set to true and onkeyup="replacewithimg(this);"

  • In head section of your aspx page add the following javascript


  • txt & img are two Arrays which holds the emotion text and emotion image element source code respectively side by side

  • replacewithimg is a function which accept div as a parameter in which the client is typing. This function is called when user press and release a key. In this function I created a for loop which checks whether any emotion text is there in div or not, if it is there then the javascript's replace() function will replace it with corresponding img tag which is stored in img array and after replacing the text set div's innerHTML to var innHTML which contains the updated innerHTML.

[Note: regular.gif, tongue.gif and Sad.gif are the names of my smiley images, Please update them if you have different names]

Download Demo Website

Friday, October 12, 2012

In this tutorial m going to demonstrate how you can add the functionality in RichTextBox to automatically insert smiley faces for emotions symbols typed in the RichTextBox like for :-) =
I know you have seen such functionality in chat clients like g-talk, Facebook  yahoo messenger etc.

Believe me it's quite simple and interesting as compared to other complicated demos available on web.

OK let me start the step-by-step guide...

Step 1: Download some smiley faces [Download]

Step 2: Create a new windows form application project in visual studio

Step 3: Add a RichTextBox control to existing Form1

Step 4: Copy all the images which you have downloaded using "Step 1" and navigate to >> visual studio select Project>>SmileyDemo Properties...

There select Resources and paste all copied images on the right side pane.
[Note : SmileyDemo is the name of your project]

Step 6: Now open Code View of Form1 (Juss right click on form and select View Code)

Step 7: Now I'm going to create a Hashtable to hold the smiley symbol [like ":-)"] and smiley image side by side (a key-value relation) and don't forget to include using System.Collections;

Step 8: Create a function to add all elements to your Hashtable, keep symbols as keys and images as values in Hashtable.
Step 9: Now I'm going to create a function to check whether any of the symbol(which we have defined in Hashtable) is there in RichTextBox control or not. If yes then we have to replace that with the corresponding Image available in Hashtable.

[Note : IndexOf function will search our symbol(basically a string) in RichTextBox's Text and return the index number where it found.

Next we need to select the symbol using RichTextBox's Select() function with starting position of selection & lenght of characters which will be selected.
ClipBoard.SetImage() function will copy the desired image
"(Image)emotions[emote]" is nothing but to get the image object corresponding to "emote" key from our Hashtable emotions and we need to typecast it to Image format.
Now what - we have some selected text in our RichTextBox, all we need to do is juss call the Paste() function of RichTextBox which will paste the copied image at the right place.]

Step 10: Now on Form1's load event call the function which we have created in "Step 8"

Step 11: Double click on RichTextBox to generate TextChanged event handler of our RichTextBox control and call the function which we have created in "Step 9".

That's it...Compile and run and see the magic 

Download Demo

Download Source Code

Wednesday, October 10, 2012

This is what I faced a small problem when using GridView.
I have a LinkButton element in the gridview and my goal is when user clicks on the button, I need to raise the grid view command event and in that event, I need to get the row values. But, the questions is how to get the current row in the grid view command event?  Below is the solution for it.
GridViewRow row = ((LinkButton)e.CommandSource).NamingContainer as GridViewRow;
Note: LinkButton class I used in the above code is assuming that the command event raised when clicked on the LinkButton control. If your requirement is not linkbutton then please place the corresponding control name.Most of the times and most of the developers never use the property available to each and every object named NamingContainer. But, there are lot of advantages with this property. Especially when we write and render controls to page dynamically then this property will help a lot. And there are many properties which will help us to solve so many problems. Use the intellisense and try to know most of the properties available for a .NET control. Hope this will help you and you got what you need.

Monday, October 8, 2012

This the question asked by so many people around me and I also faced issues couple of times of my early stages of learning.This is simple but how to get value and names as a collection and bind to drop down list is a bit difficult. 

Below is the simple logic to read all enums and create a list item and bind to drop down list. 
[Note: There are many ways to get this done, but I believe below is the best way]
Let's say I have a DropDownList in my aspx page, and an enumeration (List of User types for example). I need to bind enum values to my dropdownlist.
Here is the solution
Note : In ToString("d")  d is a format parameter which return an integer when used with enum type;
In ToString("f")  f is also a format parameter which return flag when used with enum type

Hope it help someone ..... :-)

Download Demo website

Saturday, September 29, 2012

In this tutorial I'm going to demonstrate step by step how you can create a custom control in csharp with extended features.
Lets say you want to set border color of a Textbox in your c# windows forms application. The default Textbox control does not provide us the functionality to set its border color , also the Textbox control does not have Paint event so we are not able to draw any border around textbox.
So what we can do is-

  • create a custom control
  • add a textbox in it
  • use custom control's paint event to draw border with any color
So here are the steps to achieve the above goal:

Step 1: First of all open visual studio and create a new project. Do the selection as shown in below snap.

Step 2: Now you get a custom control screen. Resize the control to (153, 22).

Step 3: Right click on Control and select View Code
Step 4: In code file create object of Textbox class and set Multiline to true & BorderStyle to None. Also set font and backcolor of Textbox object equals to custom control & then add the textbox object to custom control as shown below.
Step 5: Create an enum named as BorderSides to give more readable options to user so that the user can select on which side he/she wants to set border (we can also use int 0,1,2,3 and use if else but that is not as easy to understand as enum). Through enum we can assign meaningful names to integers.
Step 6: Now we need to create a public property to get and set textbox's text.
Step 7: Create two public variables to get Border color & Side on which user need to apply border(by default I took All sides) + one private variable for border size

Step 8: Now goto design view & select control >> generate two events(Paint & SizeChanged) of custom control as shown below
Step 9: In CustomTextBox_SizeChanged Set size, location, font and backcolor of textbox according to custom control's size, location, font and backcolor respectively. Note i keep width & height of textbox lil small as compared to custom control just to hold some space to display border.
Step 10: In CustomTextBox_Paint I've used the ControlPaint.DrawBorder to draw border around custom control as shown below. Use enum which we have created earlier to get user choice and set the border accordingly

Step 11: Now from visual studio's menu list Select Built>Built CustomTextBox. After successfull built your custom textbox control dll file will be created in >>Bin>Debug folder

To open project folder from IDE:

Now we have successfully created our custom TextboxControl, To use this control you need to add to it to Toolbox as:
  • Create a new windows form application project
  • Select Toolbox>Right click inside Toolbox and select Choose items
  • Browse the dll file which we have created earlier
  • OK

Now your new control is in your Toolbox's list of all controls, just drag n drop it on  win form to start using it.
Use the Public property Text to set text and public variables-> BorderColor & SetBorderSide to set the border color and side on which the border will be apply respectively

Tuesday, September 25, 2012

To Change GridView's Row color on mouseover :
Just put the following code snippet in GridView's RowDataBound event :

                if (e.Row.RowType == DataControlRowType.DataRow)
                    e.Row.Attributes.Add("onmouseover", ";'yellow';'hand';");
                    e.Row.Attributes.Add("onmouseout", ";");                                

Download Demo Website from here

Cheers :-)

Friday, September 21, 2012

Almost all of us used char, varchar and nvarchar datatype while designing a database table in sql but only few among us knows the exact difference between these three. That's why let me differentiate these three important datatypes and I hope it will help you all.

Char DataType: 
Char datatype which is used to store fixed length of characters. Suppose if we declared char(50) it will allocates memory for 50 characters. Once we declare char(50) and insert only 10 characters of word then only 10 characters of memory will be used and other 40 characters of memory will be wasted.

varchar DataType: 
Varchar means variable characters and it is used to store non-unicode characters. It will allocate the memory based on number of characters inserted. Suppose if we declared varchar(50) it will allocates memory of 0 characters at the time of declaration. Once we declare varchar(50) and insert only 10 characters of word it will allocate memory for only 10 characters.

nvarchar DataType:
nvarchar datatype same as varchar datatype but only difference nvarchar is used to store Unicode characters and it allows you to store multiple languages in database. nvarchar datatype will take twice as much space to store extended set of characters as required by other languages.