pls help me i m in need of a code...
first i want to describe my need...
in C#(WPF) i want a combobox and a listbox in which i need all logical drives to be populated in tha combobox and its directory should be populated in the listbox when a drive is selected..
here i wrote the code for populating drives in combobox and i got the output and the code is given below but i cant get the code for getting its subdirectory in listbox...
private void Window_Loaded(object sender, RoutedEventArgs e)
{
try
{
foreach (string logicalDrive in Environment.GetLogicalDrives())
{
comboBox1.Items.Add(logicalDrive);
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
i have done this same application in VB.NET and got the output.
the vb coding for populating the subdirectories in listbox is as follows.
Public Sub AddDirectory(ByVal subdir1 As String) For Each subdir As String In System.IO.Directory.GetDirectories(subdir1) 'add the directory to the Listbox Me.ListBox1.Items.Add(subdir) Try 'check if there are more sub directories If System.IO.Directory.GetDirectories(subdir).Length <> 0 Then AddDirectory(subdir) End If Catch ex As Exception End Try Next End Sub
i cant find a way to convert it to C# coding..(for populating the sub directories in listbox)
Pls frnds help me out to overcome my problem and give a favourable reply..
thanks in advance....
This post has been edited by jee: 27 April 2008 - 01:23 PM

New Topic/Question
Reply




MultiQuote




|