🔒 Closed Help!!! C Sharp

Status
Not open for further replies.

tamadsijuan

Honorary Poster
Get All File Name in Directory

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO;

namespace filestry
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)
{
string[] fileArray = Directory.GetFiles(@"D:\json");
for (int i = 0; i < fileArray.Length; i++)

{

textBox1.Text = fileArray;

}

}
}
}

isang filename lang nakukuha ko
 
hmmmm.. kasi siguro walang value yung fileArray.Length?
initial value kasi ng i = 0, then start ng iteration, kaso di maka move on kasi hindi naka declare anong value nya?
hula lang..

string[] fileArray = Directory.GetFiles(@"D:\json");
for (int i = 0; i < fileArray.Length; i++) -----> siguro dapat fileArray lang, same as dun sa taas nya
 
ipo-point out ko lang sa code mo:

Code:
textBox1.Text = fileArray ;

hindi ka gumamit ng array index but you're looping with i..

and hindi ka rin nag concatenate ng strings..
 
ipo-point out ko lang sa code mo:

Code:
textBox1.Text = fileArray ;

hindi ka gumamit ng array index but you're looping with i..

and hindi ka rin nag concatenate ng strings..

ok na po mga bossing salamat sa sagot..iniba ko nlng ung code nag directory.getfiles n lang ako then split ko na lang yung path..
salamat ng madami
 
Status
Not open for further replies.

About this Thread

  • 3
    Replies
  • 586
    Views
  • 3
    Participants
Last reply from:
tamadsijuan

Trending Topics

Online now

Members online
339
Guests online
837
Total visitors
1,176

Forum statistics

Threads
2,286,938
Posts
29,041,295
Members
1,217,273
Latest member
Ko11ya
Back
Top