Question setting up an array of files then looping through each file and encrypting each

catnip

New member
Joined
Nov 8, 2013
Messages
2
Programming Experience
Beginner
Hi

I am having difficulty figuring out how to put a list of files I have in a listbox into an array. I don't know how many files might end up in the array. I then want to loop through the array and encrypt each file.

any help would be appreciated I've been stuck on this for weeks. Im using vb.net
 
If you have a ListBox then what's the point of the array? Why can't you just loop through the Items of the ListBox?

Regardless, this should be done in several steps and the type of list you have is basically irrelevant. Firstly, encryption is not done one files. Encryption takes a Byte array as an input and provides a Byte array as an output. As such, you should be writing a method that does just that, i.e. has a parameter of type Byte array, performs the encryption and returns a Byte array.you can then write a method that takes a source file path and destination file path as parameters, reads the data from the input file, calls the encryption method and then saves the data to the output path. Finally, write a method that loops through a list of file paths and calls the second method for each one. You can then simply call that third method and pass it your list of file paths, either directly from the ListBox or an array or whatever.
 
Back
Top