Click here to Skip to main content
15,914,417 members
Home / Discussions / C#
   

C#

 
Generaldesign changes in runtime!!! Pin
Jassim Rahma22-Jan-05 10:17
Jassim Rahma22-Jan-05 10:17 
GeneralRe: design changes in runtime!!! Pin
spif200123-Jan-05 20:34
spif200123-Jan-05 20:34 
GeneralRe: design changes in runtime!!! Pin
Jassim Rahma25-Jan-05 1:30
Jassim Rahma25-Jan-05 1:30 
QuestionHow to scroll a windows form? Pin
E6AD22-Jan-05 10:06
E6AD22-Jan-05 10:06 
AnswerRe: How to scroll a windows form? Pin
Stefan Troschuetz23-Jan-05 0:06
Stefan Troschuetz23-Jan-05 0:06 
Generalneed beginner's treeView help Pin
SuperStruct22-Jan-05 9:03
SuperStruct22-Jan-05 9:03 
GeneralRe: need beginner's treeView help Pin
mav.northwind22-Jan-05 11:19
mav.northwind22-Jan-05 11:19 
GeneralRe: need beginner's treeView help Pin
SuperStruct26-Jan-05 5:23
SuperStruct26-Jan-05 5:23 
Your pseudocode aided me in getting the final solution. THANK YOU!!

Here's the code for displaying all folders in your computer's logical drives in the windows explorer-style (assuming you have a hard drive C:\ and D:\:


string[] logical_drives = System.IO.Directory.GetLogicalDrives();
foreach(String drive_letter in logical_drives)
{
if(drive_letter.Equals("C:\\") || drive_letter.Equals("D:\\"))
{
TreeNode root_node = new TreeNode(drive_letter);
treeView1.Nodes.Add(root_node);
populateTreeView(drive_letter, root_node);
}
}



private void populateTreeView(string directory_name, TreeNode parent_node)
{
DirectoryInfo dir_info = new DirectoryInfo(directory_name);
DirectoryInfo[] directory_array = dir_info.GetDirectories();

foreach(DirectoryInfo current_directory in directory_array)
{
TreeNode new_node = new TreeNode(current_directory.Name);
parent_node.Nodes.Add(new_node);

if(current_directory.GetDirectories() != null)
populateTreeView(current_directory.FullName, new_node);
}
}


Now that I have the treeview filled with all the folders in my drives, I need to do 1 more thing. When I select a node, I write the full path of the node to a text file to save the path. When I reopen the application, I would like to have the same folder selected so I can resume my work in that folder. This is the code I would like to have, but it doesn't work:

StreamReader sr = new StreamReader("directory.txt");
if((line = sr.ReadLine()) != null && line != "")
{
treeView1.SelectedNode.FullPath = line;
sr.Close();
}

How can I select a given node at form load time?
GeneralCreating Custom DataGrid Column Pin
Anonymous22-Jan-05 8:19
Anonymous22-Jan-05 8:19 
Generalsimple question about serviceName when developing a win service Pin
liyang yu22-Jan-05 8:10
liyang yu22-Jan-05 8:10 
GeneralRe: simple question about serviceName when developing a win service Pin
Andy Brummer23-Jan-05 19:03
sitebuilderAndy Brummer23-Jan-05 19:03 
GeneralAccess database Pin
webhay22-Jan-05 4:43
webhay22-Jan-05 4:43 
GeneralRe: Access database Pin
Colin Angus Mackay22-Jan-05 8:04
Colin Angus Mackay22-Jan-05 8:04 
Questionhow to package the C# application and MS-SQL(7) ?? Pin
Shahrouz Sadeghi22-Jan-05 4:37
Shahrouz Sadeghi22-Jan-05 4:37 
AnswerRe: how to package the C# application and MS-SQL(7) ?? Pin
Nick Parker22-Jan-05 6:47
protectorNick Parker22-Jan-05 6:47 
GeneralRe: how to package the C# application and MS-SQL(7) ?? Pin
Shahrouz Sadeghi24-Jan-05 21:46
Shahrouz Sadeghi24-Jan-05 21:46 
GeneralParsing Word documents Pin
Member 159449022-Jan-05 4:27
Member 159449022-Jan-05 4:27 
GeneralRe: Parsing Word documents Pin
Andy Brummer23-Jan-05 18:59
sitebuilderAndy Brummer23-Jan-05 18:59 
QuestionSet VScrollBar & HScrollBar colors? Pin
bbzzdd22-Jan-05 4:25
bbzzdd22-Jan-05 4:25 
AnswerRe: Set VScrollBar & HScrollBar colors? Pin
Nick Parker22-Jan-05 6:42
protectorNick Parker22-Jan-05 6:42 
GeneralListView Pin
Newbie_Toy22-Jan-05 4:00
Newbie_Toy22-Jan-05 4:00 
QuestionHow to call a function in VC++ DLL from C# Pin
Anonymous22-Jan-05 1:44
Anonymous22-Jan-05 1:44 
GeneralMarshalling of SAPI4 interfaces/structs Pin
mav.northwind22-Jan-05 0:09
mav.northwind22-Jan-05 0:09 
Generalprogress bar Pin
Newbie_Toy21-Jan-05 19:35
Newbie_Toy21-Jan-05 19:35 
GeneralRe: progress bar Pin
Dave Kreskowiak23-Jan-05 6:28
mveDave Kreskowiak23-Jan-05 6:28 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.