Click here to Skip to main content
15,919,178 members
Home / Discussions / C#
   

C#

 
GeneralRe: How do I "test" an Exception type? Pin
PIEBALDconsult19-Nov-07 4:23
mvePIEBALDconsult19-Nov-07 4:23 
GeneralRe: How do I "test" an Exception type? Pin
JoeRip18-Nov-07 21:58
JoeRip18-Nov-07 21:58 
GeneralRe: How do I "test" an Exception type? Pin
J4amieC18-Nov-07 22:33
J4amieC18-Nov-07 22:33 
GeneralRe: How do I "test" an Exception type? Pin
JoeRip18-Nov-07 22:35
JoeRip18-Nov-07 22:35 
Questioni dont want edit in combo box in window application Pin
Rajeshwar Code- Developer18-Nov-07 21:10
Rajeshwar Code- Developer18-Nov-07 21:10 
AnswerRe: i dont want edit in combo box in window application Pin
Giorgi Dalakishvili18-Nov-07 21:18
mentorGiorgi Dalakishvili18-Nov-07 21:18 
GeneralRe: i dont want edit in combo box in window application Pin
Rajeshwar Code- Developer19-Nov-07 0:42
Rajeshwar Code- Developer19-Nov-07 0:42 
QuestionTranslate into C# Pin
Programm3r18-Nov-07 21:08
Programm3r18-Nov-07 21:08 
Hi all,

I have found the following code on how to fill a tree view control with one's directory structure, but it is in VB. Can anyone please help me to translate into C#?

' In general Declarations 
   Dim tvn As Node 

Private Sub Command1_Click() 
   Me.MousePointer = vbHourglass 

   TreeView1.Nodes.Clear 
    
   ' Pathname to create folder/file list from 
   p$ = Dir1.Path 
   If Right$(p$, 1) <> "\" Then p$ = p$ + "\" 
    
   Set tvn = TreeView1.Nodes.Add(, tvwParent, p$, p$) 
    
   RecurseFiles2 p$ 
    
   Me.MousePointer = vbDefault 
End Sub 

Sub RecurseFiles2(ByVal fPath As String) 
   Dim File_Name As String 
   Dim File_Read As Integer         ' Number of Files Read 
   Dim strTempPath As String 
   Dim i As Integer 

   If Right$(fPath, 1) <> "\" Then fPath = fPath & "\" 
    
   ' to do a pattern match do, or something. 
   ' folders won`t be included in the list (not my fault) 
   ' File_Name = Dir$(fPath+"\*.exe", vbDirectory) 
    
   File_Name = Dir$(fPath, vbDirectory) 
   File_Read = 1 

   Do While File_Name <> "" 
       If File_Name <> "." And File_Name <> ".." Then 
           strTempPath = fPath & File_Name 
            
           If GetAttr(strTempPath) And vbDirectory Then 
               Set tvn = TreeView1.Nodes.Add(fPath, tvwChild, strTempPath + "\", File_Name) 
               RecurseFiles2 strTempPath    ' if a folder, then call this routine to scan that folder (recursion) 
            
               File_Name = Dir$(fPath, vbDirectory) 
               For i = 2 To File_Read 
                   File_Name = Dir$ 
               Next 
           Else 
               Set tvn = TreeView1.Nodes.Add(fPath, tvwChild, strTempPath, File_Name) 
           End If 
       End If 
        
       File_Name = Dir$ 
       File_Read = File_Read + 1 
   Loop 
End Sub 


Many Thanks
Regards,


The only programmers that are better that C programmers are those who code in 1's and 0's Green Alien | [Alien]

Smile | :) Programm3r

My Blog: ^_^

AnswerRe: Translate into C# Pin
pmarfleet18-Nov-07 21:09
pmarfleet18-Nov-07 21:09 
GeneralRe: Translate into C# Pin
Programm3r18-Nov-07 21:16
Programm3r18-Nov-07 21:16 
GeneralRe: Translate into C# Pin
pmarfleet18-Nov-07 21:20
pmarfleet18-Nov-07 21:20 
GeneralRe: Translate into C# Pin
Programm3r18-Nov-07 21:22
Programm3r18-Nov-07 21:22 
AnswerRe: Translate into C# Pin
Hari Om Prakash Sharma18-Nov-07 22:06
Hari Om Prakash Sharma18-Nov-07 22:06 
QuestionTimer Display data from database Pin
jacklynn_mei18-Nov-07 21:06
jacklynn_mei18-Nov-07 21:06 
AnswerRe: Timer Display data from database Pin
Abhijit Jana18-Nov-07 21:35
professionalAbhijit Jana18-Nov-07 21:35 
GeneralRe: Timer Display data from database Pin
jacklynn_mei18-Nov-07 22:24
jacklynn_mei18-Nov-07 22:24 
GeneralRe: Timer Display data from database Pin
NassosReyzidis19-Nov-07 4:39
NassosReyzidis19-Nov-07 4:39 
AnswerRe: Timer Display data from database Pin
sindhutiwari18-Nov-07 22:27
sindhutiwari18-Nov-07 22:27 
GeneralRe: Timer Display data from database Pin
jacklynn_mei18-Nov-07 22:56
jacklynn_mei18-Nov-07 22:56 
GeneralRe: Timer Display data from database Pin
sindhutiwari18-Nov-07 23:00
sindhutiwari18-Nov-07 23:00 
GeneralRe: Timer Display data from database Pin
jacklynn_mei19-Nov-07 14:21
jacklynn_mei19-Nov-07 14:21 
AnswerRe: Timer Display data from database Pin
KennyPatel19-Nov-07 0:22
KennyPatel19-Nov-07 0:22 
QuestionAbout InvalidOperationEception Pin
jason_mf18-Nov-07 21:05
jason_mf18-Nov-07 21:05 
AnswerRe: About InvalidOperationEception Pin
JoeRip18-Nov-07 21:39
JoeRip18-Nov-07 21:39 
GeneralRe: About InvalidOperationEception [modified] Pin
jason_mf18-Nov-07 22:16
jason_mf18-Nov-07 22:16 

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.