Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7614553
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T02:25:57+00:00 2026-05-31T02:25:57+00:00

I am in the process of makeing a small script that will take all

  • 0

I am in the process of makeing a small script that will take all files from a pre-defined folder on the server, list them, sorted by name, with a pager and a way of grouping them by [A], [B] etc. navigation.

My thoughs were to loop through all the files and put them in a Array/List/Directonary (?) and then make a Gridview/Datagrid/Listview (?) to show the files, and handle the default paging.

Looking for inputs on the best way to achieve this based on the above – any inputs and/or snippets/examples would be much appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T02:25:58+00:00Added an answer on May 31, 2026 at 2:25 am

    If you want more flexibility this is easy to do with LINQ.

    var pageSize = 25;
    var pageNum = 1;
    
    var currentPage = Directory.GetFiles("dir_path").Skip((pageNum - 1) * pageSize).Take(pageSize);
    
    // Do something with the results.
    

    De/Incrementing pageNum on each next/prev (just make sure you take 0 & the max page num into consideration).

    You can also include other linq operations like orderby, where, select, groupby, join, etc.

    From your comment:

    In the above example you can call methods on currentPage like .ToArray() / .ToList() / .ToDictionary() in order to form the data into the collection that best suits your needs.

    An example using System.Windows.Forms.ListView:

    Order the items, convert them to an array of ListViewItem and then use AddRange() on the list view’s item collection to add them to it.

    var myListView = new ListView();
    var allItems = currentPage.OrderBy(c => c).Select(c => new ListViewItem(c)).ToArray();
    myListView.Items.AddRange(allItems);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am in the process of writing a small(er) Python script to automate a
For a small software development I would like changes to follow a defined process,
I am in the process of making a website that involves a shopping cart.
I can understand Appdomain concept, but small doubt is One Process -> many application
I have a small app I've made that I intend to make available on
I am in process of making a small game, where the main Gameplay Layer
I'm in the process of designing a small website and was curious when an
We have a small 3 developer team that is currently using Subversion for our
Good afternoon. I have been making a small openGL based app for android that
I'm looking for a really really small linux distribution or process of making my

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.