Click here to Skip to main content
15,887,175 members
Home / Discussions / C#
   

C#

 
AnswerRe: How to make an application(c#) to connect to a mdf file is located on another system in the network? Pin
jschell20-Jan-12 12:46
jschell20-Jan-12 12:46 
QuestionDisplay live data Pin
CNU20-Jan-12 3:50
CNU20-Jan-12 3:50 
QuestionGetdirectories performance problems Pin
Anders Hedén20-Jan-12 1:25
Anders Hedén20-Jan-12 1:25 
AnswerRe: Getdirectories performance problems Pin
Luc Pattyn20-Jan-12 1:40
sitebuilderLuc Pattyn20-Jan-12 1:40 
GeneralRe: Getdirectories performance problems Pin
Anders Hedén20-Jan-12 2:04
Anders Hedén20-Jan-12 2:04 
AnswerRe: Getdirectories performance problems Pin
Luc Pattyn20-Jan-12 2:17
sitebuilderLuc Pattyn20-Jan-12 2:17 
GeneralRe: Getdirectories performance problems Pin
Anders Hedén20-Jan-12 3:49
Anders Hedén20-Jan-12 3:49 
GeneralRe: Getdirectories performance problems Pin
Anders Hedén20-Jan-12 8:47
Anders Hedén20-Jan-12 8:47 
Now lets see this is the basic code for populating my treeview. It's slow because i add all directories at once. This is written in vb sorry for that, i hope you don't get to mad with me Sigh | :sigh: , my other C# code was a real mess atm.

VB
Private Sub PopulateTreeView(ByVal setPath As String)
    Dim rootNode As TreeNode
    Dim info As New DirectoryInfo(setPath)
    rootNode = New TreeNode(info.Name)
    rootNode.Tag = info
    GetDirectories(info.GetDirectories(), rootNode)
    TreeView1.Nodes.Add(rootNode)
End Sub

Private Sub GetDirectories(ByVal subDirs() As DirectoryInfo, ByVal nodeToAddTo As TreeNode)
    Dim aNode As TreeNode
    Dim subDir As DirectoryInfo
    For Each subDir In subDirs
        aNode = New TreeNode(subDir.Name, 0, 0)
        aNode.Tag = subDir
        If ((subDir.Attributes And FileAttribute.Hidden) <> FileAttribute.Hidden) Then
            If subDir.GetDirectories().Count() > 0 Then
                GetDirectories(subDir.GetDirectories(), aNode)
            End If
            nodeToAddTo.Nodes.Add(aNode)
        End If
    Next subDir
End Sub



Here is also the code i used to add dummy-nodes to improve the speed, but the problem with this solutions is that you still check the underlying subdirectory with a count()/length. http://stackoverflow.com/questions/2135851/treeview-control-contextswitchdeadlock-workarounds

I don't really know how to solve this? I have tried the same with enumeration of directories but without greater performance. I've also tried to remove the node functions to see if they slow down the process but without any better performance.
Dead | X|
AnswerRe: Getdirectories performance problems Pin
Luc Pattyn20-Jan-12 18:23
sitebuilderLuc Pattyn20-Jan-12 18:23 
GeneralRe: Getdirectories performance problems Pin
Anders Hedén21-Jan-12 23:46
Anders Hedén21-Jan-12 23:46 
AnswerRe: Getdirectories performance problems Pin
Luc Pattyn22-Jan-12 3:40
sitebuilderLuc Pattyn22-Jan-12 3:40 
GeneralRe: Getdirectories performance problems Pin
Anders Hedén22-Jan-12 10:25
Anders Hedén22-Jan-12 10:25 
AnswerRe: Getdirectories performance problems Pin
Luc Pattyn22-Jan-12 10:43
sitebuilderLuc Pattyn22-Jan-12 10:43 
AnswerRe: Getdirectories performance problems Pin
Shameel20-Jan-12 2:18
professionalShameel20-Jan-12 2:18 
GeneralRe: Getdirectories performance problems Pin
Anders Hedén20-Jan-12 4:05
Anders Hedén20-Jan-12 4:05 
AnswerRe: Getdirectories performance problems Pin
Shameel20-Jan-12 4:56
professionalShameel20-Jan-12 4:56 
AnswerRe: Getdirectories performance problems Pin
BobJanova20-Jan-12 2:32
BobJanova20-Jan-12 2:32 
AnswerRe: Getdirectories performance problems Pin
Pete O'Hanlon20-Jan-12 2:49
mvePete O'Hanlon20-Jan-12 2:49 
QuestionProblem Copying Raw RGB Data to Bitmap Pin
Jaffer Mumtaz19-Jan-12 23:20
Jaffer Mumtaz19-Jan-12 23:20 
AnswerRe: Problem Copying Raw RGB Data to Bitmap Pin
Luc Pattyn19-Jan-12 23:50
sitebuilderLuc Pattyn19-Jan-12 23:50 
GeneralRe: Problem Copying Raw RGB Data to Bitmap Pin
Jaffer Mumtaz19-Jan-12 23:55
Jaffer Mumtaz19-Jan-12 23:55 
AnswerRe: Problem Copying Raw RGB Data to Bitmap Pin
BobJanova20-Jan-12 2:17
BobJanova20-Jan-12 2:17 
GeneralRe: Problem Copying Raw RGB Data to Bitmap Pin
Jaffer Mumtaz21-Jan-12 7:31
Jaffer Mumtaz21-Jan-12 7:31 
GeneralRe: Problem Copying Raw RGB Data to Bitmap Pin
BobJanova21-Jan-12 10:59
BobJanova21-Jan-12 10:59 
QuestionTime taken to load a contrl Pin
Subin Mavunkal19-Jan-12 19:15
Subin Mavunkal19-Jan-12 19:15 

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.