3
Answers

Tracking names of dynamically generated controls

ken

ken

19y
3.4k
1
I am creating separate checkedlistbox for different sections of a database at runtime, which i got to work the way i want to, my question is how do i keep track of the names of the checkedlistboxes so that i can refer to them later in code. Say the program creates 3 boxes. how do i name them consecutively and call them further into the program in another sub?
Answers (3)
0
Abhishikt Kujur

Abhishikt Kujur

NA 3 0 18y
Hi all,
        After searching a while i got some results...I had to search files from a server location so it was needed a path to map with server which I did using,        
                            string StrRoot_E = Server.MapPath("../FolderName1/");
var StrRoot_E contains the string "../FolderName1/" is the path for the specific server Directory and to extract files of specific types,
                           string files_E() = Directory.GetFiles(StrRoot_E, "*.zip");
"*.zip " is the filetype which is stored in an array of strings,and then you can extract each file from that array of strings and can use for purpose.

Method Server.MapPath() takes string argument which is the physical path in your server while method Directory.GetFiles() takes two arguments, the Path of the Directory and the fileType both as strings.