Click here to Skip to main content
15,905,229 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I want to create textfile having columns

column1 column2 column3

I want data in column1 is retrived from gridview column1 & column2 is retrived from gridview column2.

I want data in column3 if record exists then already exists otherwise Saved Successfully.

eg:

column1 column2 column3

01 A already exists
02 B Saved Successfully

I am using Windowsforms & .NET FRamework 2.0.

Can any one help me to solve this problem.
Posted
Comments
nandakishoreroyal 4-Mar-14 5:26am    
Please refer the following link http://msdn.microsoft.com/en-us/library/8bh11f1k.aspx
Maciej Los 4-Mar-14 5:28am    

Please refer following Link
 
Share this answer
 
Comments
Karthik Achari 4-Mar-14 5:33am    
i want in windowsform application,can you help me to solve this problem.
nandakishoreroyal 4-Mar-14 5:41am    
Use that code in windows form application. It will work.
First of all, please read my comment to the question.
Secondly, follow the anwers to your previous question and try to do something!

It would be something like this:
C#
using (System.IO.StreamWriter file = new System.IO.StreamWriter(@"C:\MyData.txt"))
{
    foreach (DataGridViewRow row in DataGridView1.Rows)
    {
        file.WriteLine(String.Format("{0} {1} {2}", row[0], row[1], row[2]));
    }
}


Note: not tested!

For further information, please see: String.Format method[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900