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