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

  • Home
  • SEARCH
  • 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 6363787
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T00:04:50+00:00 2026-05-25T00:04:50+00:00

string [] filenames = openFileDialog1.FileNames; How can I read this array? Would I need

  • 0

string [] filenames = openFileDialog1.FileNames;

How can I read this array?

Would I need to set each file path to its own string???
I’m clueless.

  • 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-25T00:04:51+00:00Added an answer on May 25, 2026 at 12:04 am

    Do you mean access the elements in the array?

    for (int i = 0; i < filenames.Length; i++)
        MyDoSomethingMethod(filenames[i]);
    

    As pointed out by another answer you can also use a foreach to access each item

    foreach (String filename in filenames)
        DoSomething(filename);
    

    When you access filenames[some_index] you access the string already so there’s no need to save it to another variable to work with it same applies to foreach loop.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My application builds many objects in memory based on filenames (among other string based
string fileName = test.zip; string path = c:\\temp\\; string fullPath = path + fileName;
This is my procedure: bool Open(std::string filename) { ... HANDLE hFile = CreateFile(filename.c_str(), GENERIC_READ,
string exeFile = (new System.Uri(Assembly.GetEntryAssembly().CodeBase)).AbsolutePath; string exeDir = Path.GetDirectoryName(exeFile); string fileName = Path.Combine(exeDir, @..\..\xml\SalesOrderXMLData.csv.xml);
The StreamReader locks a text file whilst it is reading it. Can I force
Help! I can't figure out how to close the file. It always gives me
i have the following code. i need to do this: public void Window1() {
I am calling this zip_threading class in another class. string a = zip_threading(?,?) but
I am fiddling around with the following code. However, I need the file name
I have an app where users can select an Excel file, that excel file

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.