Showing posts with label Export to .csv file. Show all posts
Showing posts with label Export to .csv file. Show all posts

Tuesday, May 12, 2009

Export DataGridView into .csv file

Following example I am trying to save the DataGridView's Data into .csv file

Please create a Windows Application and Add a DataGridView and a button on Form1, to fill the data initially please add following code in Form1_Load

image

Double click on the Button and add following code in Button1_Click, in this code we are reading all columns and rows and forming a string and saving in data.csv file

image

Now we are ready with our code, just build, run and test.

Tags: Export DataGridView to .csv file, Windows Forms, C#, .NET