Home C# Display file in a directory and print every 5th row a line
Display file in a directory and print every 5th row a line PDF Print E-mail
Written by Siva   
Sunday, 31 October 2010 23:16

This bellow c# code displays all files in the C:\windows folder

also prints every 5th line "After every 5th row print this"!

I am going to use this code to grabe images from image folder and create HTML file.

 

------------- bellow C# code ---------Framework 4 -------------

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;


namespace vmgenie001.Pages.TestArea
{
    public partial class listfiles : System.Web.UI.Page
    {
        private int j = 1;
        protected void Page_Load(object sender, EventArgs e)
        {
           
            //This code displays all filers in WINDOWS directory..
            System.IO.DirectoryInfo dir = new System.IO.DirectoryInfo("C:/windows"); 
            foreach (System.IO.FileInfo f in dir.GetFiles("*.*"))
            {
                j = j + 1; 
                             Response.Write(" -- " + f.Name +"-- ");
                if (j % 5 == 0)
                {
                    Response.Write ("After every 5th row print this");
                }
            }

        }

    }
}

 

Last Updated on Sunday, 31 October 2010 23:18
 
 

Advertisement

Featured Links:
HREmail.com
Looking for job? Try HREmail.com
Want to have CMS based Websites?
Try siliconwebcreators.com to CMS based websites.
VM Solutions Inc
For best VM solutions..
Digital Procedure Inc.
Looking for Oracle /SAP /Weblogic Consulting services? visit digitalprocedure.com