korasoglu Posted June 22, 2015 Share Posted June 22, 2015 Arkadaşlar bir klasördeki dosyaları nasıl listeletebilirim. openFiledialog ile tüm dosyaları datagrite nasıl çekebilirim. Quote Link to comment Share on other sites More sharing options...
muratboy31 Posted June 23, 2015 Share Posted June 23, 2015 Merhaba, denedim c# yüklü değil, sen bi dene FolderBrowserDialog fbd = new FolderBrowserDialog(); dataGridView1.ColumnCount = 1; dataGridView1.Columns[0].Name = "Dosyalar"; string[] files = Directory.GetFiles(fbd.SelectedPath); for (int i = 0; i >= files.Length ; i++) { string[] row1 = new string[] { files.ToString() }; dataGridView1.Rows.Add(row1); } Quote Link to comment Share on other sites More sharing options...
korasoglu Posted June 23, 2015 Author Share Posted June 23, 2015 (edited) Bunlar çalışmadı aynı zamanda foreach kullanılsan daha isabetli olmazmı Şu yeterli fakat dosya isimlerini alamadım donen f onunda FileInfo alınacak ama beceremedim yardım ederseniz sevinirim. FolderBrowserDialog dialog = new FolderBrowserDialog(); dialog.Description = "Seçim Yapınız"; if (dialog.ShowDialog() == DialogResult.OK) { listBox1.Items.Clear(); listBox1.Refresh(); //dataGridView1.ColumnCount = 2; // dataGridView1.Columns[0].Name = "isa"; //dataGridView1.Columns[1].Name = "avci"; string folderName = dialog.SelectedPath; foreach (string f in Directory.GetFiles(folderName))//(folderName) { // şu şekilde sorun çözülüyor FileInfo dosyabilgisi = new FileInfo(f); listBox1.Items.Add(dosyabilgisi); listBox1.Items.Add(f); string[] row1 = new string[] { folderName.ToString(), folderName.ToString() }; dataGridView1.Rows.Add(row1); } } Edited June 25, 2015 by korasoglu Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.