🔒 Closed Help!!! C Sharp

Status
Not open for further replies.

tamadsijuan

Established
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
  • 581
    Views
  • 3
    Participants
Last reply from:
tamadsijuan

Online now

Members online
984
Guests online
1,417
Total visitors
2,401

Forum statistics

Threads
2,276,208
Posts
28,968,320
Members
1,231,166
Latest member
williamfreede
Back
Top