Click here to Skip to main content
15,887,485 members
Home / Discussions / Visual Basic
   

Visual Basic

 
QuestionNavigating folders in listview. Pin
GeekyGirlPanacea17-Sep-15 0:29
GeekyGirlPanacea17-Sep-15 0:29 
AnswerRe: Navigating folders in listview. Pin
Brisingr Aerowing17-Sep-15 0:48
professionalBrisingr Aerowing17-Sep-15 0:48 
GeneralRe: Navigating folders in listview. Pin
GeekyGirlPanacea17-Sep-15 1:02
GeekyGirlPanacea17-Sep-15 1:02 
AnswerRe: Navigating folders in listview. Pin
Richard MacCutchan17-Sep-15 0:51
mveRichard MacCutchan17-Sep-15 0:51 
GeneralRe: Navigating folders in listview. Pin
GeekyGirlPanacea17-Sep-15 1:04
GeekyGirlPanacea17-Sep-15 1:04 
GeneralRe: Navigating folders in listview. Pin
Richard MacCutchan17-Sep-15 1:21
mveRichard MacCutchan17-Sep-15 1:21 
GeneralRe: Navigating folders in listview. Pin
GeekyGirlPanacea17-Sep-15 16:17
GeekyGirlPanacea17-Sep-15 16:17 
QuestionVisual Basic program to recursively take ownership of a folder and all its sub-contents Pin
Member 1186689316-Sep-15 7:15
Member 1186689316-Sep-15 7:15 
I need to create a tool that will recursively take ownership of a folder for our helpdesk team, we logon with admin tokens to perform administrative tasks so anyone who uses this tool will only be IT personnel and will have local admin rights when they logon with their token. Users are losing data because of corrupt file synchronization. The only way we can retrieve it is to take ownership of the c:\windows\csc and its contents. This is a very short explanation of why I need a tool, the story is much longer but this lays out why I started this project. I am new to visual basic and programming.

I wrote a program that will allow you to browse to the folder you want to take ownership of but I can't figure how get all the subdirectories. Can someone please help me make this program work recursively?

Here is the main part of the code and this will take ownership on the parent directory eg. c:\test:

#End Region
Private Sub bnBrowseFile_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bnBrowseFolder.Click

If FolderBrowserDialog1.ShowDialog() = DialogResult.OK Then
Me.folderName.Text = FolderBrowserDialog1.SelectedPath

End If
End Sub
Private Sub bnQuit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bnQuit.Click
Me.Close()
End Sub

Private Sub bnDoit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bnDoit.Click

If tbUserName.Text = "" Then
MsgBox("Please type your NMEA account name (eg. Domain\adminaccountname)", MsgBoxStyle.Exclamation)
Exit Sub
End If
strPath = folderName.Text
For Each Folder In IO.Directory.GetDirectories(strPath, "*", IO.SearchOption.AllDirectories)
Next

strPath = folderName.Text
strUser = tbUserName.Text

Try
ChangeOwner(strPath, strUser)
Catch ex As Exception
MsgBox("Error: " & ex.Message, MsgBoxStyle.Critical)
End Try
MsgBox("Done!")
End Sub
AnswerRe: Visual Basic program to recursively take ownership of a folder and all its sub-contents Pin
Wendelius16-Sep-15 7:44
mentorWendelius16-Sep-15 7:44 
GeneralRe: Visual Basic program to recursively take ownership of a folder and all its sub-contents Pin
Member 1186689316-Sep-15 7:58
Member 1186689316-Sep-15 7:58 
GeneralRe: Visual Basic program to recursively take ownership of a folder and all its sub-contents Pin
Wendelius16-Sep-15 8:53
mentorWendelius16-Sep-15 8:53 
GeneralRe: Visual Basic program to recursively take ownership of a folder and all its sub-contents Pin
Member 1186689316-Sep-15 10:10
Member 1186689316-Sep-15 10:10 
AnswerRe: Visual Basic program to recursively take ownership of a folder and all its sub-contents Pin
Wendelius16-Sep-15 17:05
mentorWendelius16-Sep-15 17:05 
GeneralRe: Visual Basic program to recursively take ownership of a folder and all its sub-contents Pin
Member 1186689317-Sep-15 11:13
Member 1186689317-Sep-15 11:13 
GeneralRe: Visual Basic program to recursively take ownership of a folder and all its sub-contents Pin
Wendelius18-Sep-15 22:47
mentorWendelius18-Sep-15 22:47 
QuestionAutorun vb program from removable device Pin
Otekpo Emmanuel14-Sep-15 1:34
Otekpo Emmanuel14-Sep-15 1:34 
AnswerRe: Autorun vb program from removable device Pin
Brisingr Aerowing14-Sep-15 2:00
professionalBrisingr Aerowing14-Sep-15 2:00 
AnswerRe: Autorun vb program from removable device Pin
Dave Kreskowiak14-Sep-15 2:25
mveDave Kreskowiak14-Sep-15 2:25 
AnswerRe: Autorun vb program from removable device Pin
Tim Carmichael14-Sep-15 2:31
Tim Carmichael14-Sep-15 2:31 
QuestionHow Can I Remove Duplicate Item From Combobox With Datasource? Pin
Member 1051522510-Sep-15 2:55
professionalMember 1051522510-Sep-15 2:55 
AnswerRe: How Can I Remove Duplicate Item From Combobox With Datasource? Pin
Dave Kreskowiak11-Sep-15 3:41
mveDave Kreskowiak11-Sep-15 3:41 
Questionasking for source code of visual basic 6.0 Pin
Member 119717979-Sep-15 6:19
Member 119717979-Sep-15 6:19 
AnswerRe: asking for source code of visual basic 6.0 Pin
Richard MacCutchan9-Sep-15 6:23
mveRichard MacCutchan9-Sep-15 6:23 
AnswerRe: asking for source code of visual basic 6.0 Pin
Dave Kreskowiak9-Sep-15 7:03
mveDave Kreskowiak9-Sep-15 7:03 
QuestionRe: asking for source code of visual basic 6.0 Pin
Paul Conrad13-Sep-15 6:08
professionalPaul Conrad13-Sep-15 6:08 

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.