List index in C#
-
Hi I want to list folders,subfolders and files from all drives in a system.I tried a code which works well for C:\.I want the same for the other drives.I have listed the drives in listbox.Please give your suggestions.
private void PaintList(String sss)
{try { reader = new XmlTextReader("path.xml"); while (reader.Read()) { switch (reader.NodeType) { case XmlNodeType.Text: //Display the text in each element. // Console.WriteLine(reader.Value); String s1; s1 = reader.Value; String ss; ss = listBox1.SelectedItem.ToString(); sss = ss + s1; object o3 = (object)sss; DirectoryInfo dire = new DirectoryInfo(sss); //DirectoryInfo\[\] dirs = dire.GetDirectories(); if (dire.Exists) { String\[\] folder; folder = Directory.GetDirectories(sss); foreach (string foldername in folder) { DirectoryInfo di = new DirectoryInfo(foldername); if (di.Exists) { String\[\] files; files = Directory.GetFiles(foldername, "\*.exe\*"); //FileInfo\[\] fi = dire.GetFiles(); foreach (String filename in files) { lvi = new ListViewItem(); lvi.Text = filename; listView1.Items.Add(lvi); lvsi = new ListViewItem.ListViewSubItem(); lvsi.Text = filename.Length.ToString(); lvi.SubItems.Add(lvsi);
-
Hi I want to list folders,subfolders and files from all drives in a system.I tried a code which works well for C:\.I want the same for the other drives.I have listed the drives in listbox.Please give your suggestions.
private void PaintList(String sss)
{try { reader = new XmlTextReader("path.xml"); while (reader.Read()) { switch (reader.NodeType) { case XmlNodeType.Text: //Display the text in each element. // Console.WriteLine(reader.Value); String s1; s1 = reader.Value; String ss; ss = listBox1.SelectedItem.ToString(); sss = ss + s1; object o3 = (object)sss; DirectoryInfo dire = new DirectoryInfo(sss); //DirectoryInfo\[\] dirs = dire.GetDirectories(); if (dire.Exists) { String\[\] folder; folder = Directory.GetDirectories(sss); foreach (string foldername in folder) { DirectoryInfo di = new DirectoryInfo(foldername); if (di.Exists) { String\[\] files; files = Directory.GetFiles(foldername, "\*.exe\*"); //FileInfo\[\] fi = dire.GetFiles(); foreach (String filename in files) { lvi = new ListViewItem(); lvi.Text = filename; listView1.Items.Add(lvi); lvsi = new ListViewItem.ListViewSubItem(); lvsi.Text = filename.Length.ToString(); lvi.SubItems.Add(lvsi);
use
Directory.GetLogicalDrives()
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L %^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2 W_AD`EPABIKRDFVS)EVLQK)JKQUFK[M`UKs*$GwU#QDXBER@CBN% R0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
----------------------------------------------- 128 bit encrypted signature, crack if you can
-
use
Directory.GetLogicalDrives()
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L %^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2 W_AD`EPABIKRDFVS)EVLQK)JKQUFK[M`UKs*$GwU#QDXBER@CBN% R0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
----------------------------------------------- 128 bit encrypted signature, crack if you can
Hi I am getting the list of all the drives.I am able to list the files for C:\.I want to do the same for the other drives.The index of the list should change.If i use the following i have to do the same coding inside each if statement.Can you give some alternative
int r=listBox1.SelectedIndex;
if(r==0)
{
}
if(r==1)
{
} -
Hi I am getting the list of all the drives.I am able to list the files for C:\.I want to do the same for the other drives.The index of the list should change.If i use the following i have to do the same coding inside each if statement.Can you give some alternative
int r=listBox1.SelectedIndex;
if(r==0)
{
}
if(r==1)
{
}string[] drives = Directory.GetLogicalDrives();
for(int a=0;a<drive.length;a++)>
{
//here your code
}TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L %^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2 W_AD`EPABIKRDFVS)EVLQK)JKQUFK[M`UKs*$GwU#QDXBER@CBN% R0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
----------------------------------------------- 128 bit encrypted signature, crack if you can