15,908,673 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View Python questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by Member 11155542 (Top 16 by date)
Member 11155542
26-Oct-14 4:32am
View
Thank you CodingK, you've Helped me enough :-), I'm going to try your advice. Once again you are the only person who could help on this post, so you are a true coder :-) and I Thank you very much.
Member 11155542
25-Oct-14 17:59pm
View
Hi CodingK, Thank you very much for taking time and writing all of this code, much appreciated. currently when folder are created it's created as subfolders to each other, is there a way that each folder can be created as separate folders? e.g.
c:\CB1 New Folder
c:\CB2 New Folder
c:\CB3 New Folder
c:\CB4 New Folder
instead of when all checkboxes are selected this is created c:\CB1 New Folder\CB2 New Folder\CB3 New Folder\CB4 New Folder, Thank you.
Member 11155542
24-Oct-14 10:05am
View
That would be great, I'll be online later on. Thank you CodingK for your understanding and once again, accept my apologies.
Member 11155542
24-Oct-14 9:38am
View
I do agree and that's what I'll do from now on
Member 11155542
24-Oct-14 9:08am
View
Not a Problem at all CodingK, Thank you for all the help, best regards and take care, keep helping the noobs, you are good at it.
Member 11155542
24-Oct-14 8:56am
View
my apologies, didn't mean anything bad by it, just thought as I've changed the code... I'll accept it back, after all your code is the right one. I'm new to all of this.
Member 11155542
24-Oct-14 5:07am
View
Deleted
Hi CokingK, I do still need your assistance if possible, I've managed as litle as possible to copy the file to Temp folder, here is the code:
<pre lang="vb">#Region "Declaration"
Dim FileDetails As New Dictionary(Of String, String)
Dim CheckedItem As Integer = 0
Dim CheckedSelected As String = ""
#End Region
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
End Sub
#Region "Subroutines"
Private Sub btnBrowse_Click(sender As Object, e As EventArgs) Handles btnBrowse.Click
Dim result As DialogResult = FolderBrowserDialog1.ShowDialog()
If Not result = Windows.Forms.DialogResult.Cancel Then
GetListOfFiles(Currentlocation:=FolderBrowserDialog1.SelectedPath, NewLocation:=FolderBrowserDialog1.SelectedPath & "\" & "", Done:=False)
End If
End Sub
Private Sub btnCopyFiles_Click(sender As Object, e As EventArgs) Handles btnCopyFiles.Click
Dim NewLocation As String = TextBox1.Text
Dim fdAr As String = CheckBox1.Text
For Me.CheckedItem = 0 To CheckedListBox1.CheckedItems.Count - 1
CheckedSelected = CheckedListBox1.CheckedItems(CheckedItem).ToString
If FileDetails.ContainsKey(CheckedSelected) Then
' Write value of the key.
Dim zLocation As String = Nothing
zLocation = FileDetails.Item(CheckedSelected)
Dim Comparison As KeyValuePair(Of String, String)
Dim ComparisonValue As String = Nothing
Dim eFileNameOnly As String = Nothing
For Each Comparison In FileDetails
If Comparison.Key = CheckedSelected Then
ComparisonValue = Comparison.Value & Comparison.Key
eFileNameOnly = Comparison.Key
FileCopy(iLocation:=zLocation, iNewLocation:=zLocation & NewLocation & "", eFile:=ComparisonValue, FileNameOnly:=eFileNameOnly, Done:=False)
End If
Next
End If
Next
'Dim itemChecked As Object
'For Each itemChecked In CheckedListBox1.CheckedItems
' If CheckBox1.CheckState = 1 Then
' My.Computer.FileSystem.CreateDirectory("" & txt & "\Folder1")
' MessageBox.Show("Folder1 created successfully, click OK")
'For Each Comparison In FileDetails
' If Comparison.Key = CheckedSelected Then
' ComparisonValue = Comparison.Value & Comparison.Key
' eFileNameOnly = Comparison.Key
' FileCopy(iLocation:=zLocation, iNewLocation:=zLocation & "Folder1\", eFile:=ComparisonValue, FileNameOnly:=eFileNameOnly, Done:=False)
' End If
'Next
' End If
'Next
'If CheckBox2.CheckState = 1 Then
' My.Computer.FileSystem.CreateDirectory("" & txt & "\Folder2")
' MessageBox.Show("Folder2 created successfully, click OK")
'End If
'If CheckBox3.CheckState = 1 Then
' My.Computer.FileSystem.CreateDirectory("" & txt & "\Folder3")
' MessageBox.Show("Folder3 created successfully, click OK")
'End If
'If CheckBox4.CheckState = 1 Then
' My.Computer.FileSystem.CreateDirectory("" & txt & "\Folder4")
' MessageBox.Show("Folder4 created successfully, click OK")
'End If
End Sub
Private Function GetListOfFiles(ByVal Currentlocation As String, ByVal NewLocation As String, ByRef Done As Boolean) As String
NewLocation = TextBox1.Text
If Directory.Exists(NewLocation) = False Then
'My.Computer.FileSystem.CreateDirectory("" & NewLocation & "\ar")
'MessageBox.Show("folder created successfully, click OK")
If CheckBox1.CheckState = 1 Then
My.Computer.FileSystem.CreateDirectory("" & NewLocation & "\ar")
MessageBox.Show("Arabic folder created successfully
Member 11155542
20-Oct-14 12:00pm
View
Good point on selecting the files, I'll use the OpenFolderDialog, Thank you very much for you help, I'll try to use your code and try to add the textbox as the path and the checkboxes for folder creation before folder is created so the file(s) can be copied to the folder(s) depending on the checkbox checked. Once again Thank you CodingK.
Member 11155542
20-Oct-14 11:38am
View
Yes, I've seen it, please bare with me, I'm learning and it will get easier, I believe.
Member 11155542
20-Oct-14 10:19am
View
Hi CodingK, Yes I have tried your code but, the reason I'm using OpenFileDialog is that I can select individually which files I want to copy and add them to the CheckedListBox
Member 11155542
20-Oct-14 8:46am
View
Hi CodingK, I have updated my question, if you got time please have a look. Thank you
Member 11155542
20-Oct-14 8:11am
View
I'll update my question
Member 11155542
20-Oct-14 8:11am
View
I'll update my question
Member 11155542
20-Oct-14 8:11am
View
Sorry guys, I'll update my Question
Member 11155542
20-Oct-14 5:07am
View
CodingK, Thank you very much for your Reply, I'm looking at your code and see how I can use it, I'll let you know if I have another question. Thanks
Member 11155542
17-Oct-14 9:09am
View
Sinisa, you are right but the code when run is throwing an Exception around "My.Computer.FileSystem.CreateDirectory("" & FolderName & "")" and I don't know why
Show More