>
KenL.Net  A Developer's Expedition






Skip Navigation Links
Home
Skip Navigation Links
Architecture
Skip Navigation Links
Windows
Skip Navigation Links
Web
Skip Navigation Links
Sharepoint
Skip Navigation Links
Data Development

Windows Development

Split CSV to String Array

 
protected virtual string[] SplitCSV(string line)
      {         System.Text.RegularExpressions.RegexOptions options = ((System.Text.RegularExpressions.RegexOptions.IgnorePatternWhitespace | System.Text.RegularExpressions.RegexOptions.Multiline)
            | System.Text.RegularExpressions.RegexOptions.IgnoreCase);
         Regex reg = new Regex("(?:^|,)(\\\"(?:[^\\\"]+|\\\"\\\")*\\\"|[^,]*)", options);
         MatchCollection coll = reg.Matches(line);
         string[] items = new string[coll.Count];
         int i = 0;
         foreach(Match m in coll)
         {
            items[i++] = m.Groups[0].Value.Trim('"').Trim(',').Trim('"').Trim();
         }
         return items;
      }




More Recent Windows Development Articles:

Select Top XML Nodes using XPath
This example shows how to select Top N nodes of the specific name from an XML document.

Deserialize XML object
Example on how to Deserialize and XML object into a Class/Object

Read Connection String From DLL.config file
Example on how to read from a DLL's App Config - useful when using class library and you want the library to have its own app.config

Read Connection String From DLL.config file
Example on how to read from a DLL's App Config - useful when using class library and you want the library to have its own app.config

Thread Pooling
Thread Pooling Example

Embed image into email
Don't make your users download images with Outlook... Embed the image...

Basic number formatting specifiers
String formating 101

Application location and the Microsoft Logo Program
Follow the official Microsoft Guidelines with application location and the logo program

Encryption 101
Encrypt and Decrypt strings of data to store into datbases, etc.

Making Images - Zip files and FTP
Making images and making zip files made easy. Add in FTP and you have a complete app

Indenty Impersonation
Example of Indenty Impersonation

Windows Commands such as logoff, reboot, shutdown
Examples of dynamic Windows commands

Get User's Windows login name
Get User's Windows login name

Theading and the Internal Class
How to use threading in your classes

Write to Application Log
Example on how to write to the Windows Application Log file.

The Windows Registry
Programming to the Windows Registry is simple!

Environmental Variables
How to use Environmental Variables

Simple File watcher
An example of how to wait/watch for files changes

Regex Example
Use Regex to match strings

Using License Providers
add license providers to your code

Using Enumerations
Enumerations are better than using plain integers...

Simple Active Directory Reader
More and more AD is becoming a major part of system development.

Stored Procedure to DataSet
The beloved dataset. Here is an example on how to create and use them.

Exporting a datagrid object's data to Excel
Example on how to send data to Excel

Creating a dataset is simple
Example on how to create and use DataSets

SQL Connection String
How to use SQL connections strings with both Web Applications and Windows Applications

Excel as a database - ADO.Net
Utilized Excel's OleDB provider to work like SQL

Check and install software updates
Have your application check for software updates

DataGridView - Binding and Filter
DataGridView - Binding and Filter

Fading Windows Notification Form
If you are a Office user, you know how cool the fading email notification form is. If you have not seen it, you will love it.

Single application - Only allow one version to run
Force only a single instance of your application to work at a time

MDI & SDI Windows Forms
Example on how to use and the difference between MDI and SDI windows forms

Windows Combo & List Box Class
Easy Windows Listbox/Combobox class object

CheckBoxes
Easy Checkbox example

The error provider
Simple method for windows Error management

Have you ever used the DOS command Net Send?
This handy little tool will allow you to send Net Send messages to a group of people at once

ComboBox Key Down event
How to capture and use key down events within the combo and listbox

Custom Log File
Create your own log file

Open MS Word or any program
Example on how to use System Process to open another program from C#.



KenL.Net - Home Page of Ken Lovely, MCSE, MCDBA free source code, .NET Development, .NET technology, .NET platform, .NET, Windows Longhorn, longhorn programming, aero, avalon, Indigo, Longhorn, WinFS, WinFX, XAML,Longhorn SDK, C#, C#.NET, C# .NET, CSharp, Windows Longhorn, Whidbey, Visual Studio .NET, XAML, Avalon, Aero, WinFS, WinFX, Avalon, dot net, dotnet, .net, csharp, c sharp, c, sharp, c-sharp, C#, dotnet, VC#, Visual C#, .NET, ASP, ASP+, CSharp, C-Sharp, VB.NET, XML, SOAP, dot net jobs, contracts, books, downloads, software, Java, J#, Visual J#, JSharp, j-sharp, cobol, cobol.net, cobol dot net, speech.net, speech, mobile programming, threading, security, .net security, xml.net, printing, training, dot net training, Tutorials, Articles, Programming, web forms, windows forms, ASP.NET, Web services, XML Web services, Visual studio .net, VC++.NET, managed extensions in C++, MFC, ATL, COM, COM+, DCOM, Pocket PC, Embedded& developement, JScript .NET, VBScript .NET, Mono Project, Eiffel .NET, Windows CE .NET, Magazines, ADO.NET, Cryptography, Active Directory, DirectX, Exception Handling, GDI+, GDI, Strings, Arrays, C# Language, Applied .NET, ken lovely, mcse, mcad, mcsd, mcdba