I am writing a web application that parses log files created by another application. In one particular section of the log collection the parent folder and names of the log files are dynamically generated to include the server name in the files and the server names for their parent directories. For example:
I have for loops written to collect the folder names and the full log file name/path of each log file of interest located in each directory. The number of possible directories that need to be added to the array is 6 and the number of log files is also 6 (I only need data from one log in each directory). Since there are up to 6 possible tables needed to display the data from the log files I'm assuming the best method to do this is to create the controls dynamically?
The part I'm stuck on at the moment is how to manage placing controls and dropping the data into the controls. Ideally for each file read i would like to generate a table with 2 rows and 3 colums in each row to display the data.
'Loop through the Storage System sub-folders and list folders and files.
Dim storage As String = txtPath.Text & "\StorageSystem\"
Dim folderString As String = ""
For Each folder As String In Directory.GetDirectories(storage)
folderString &= folder.ToString
folderString &= vbCrLf
txtTest.Text = folderString
'Dim fileString As String = ""
For Each storageFile As String In IO.Directory.GetFiles(txtPath.Text & "\StorageSystem\", "*_SlotConfigInfo.log", SearchOption.AllDirectories)
'Dim txtBoxForData As New TextBox()
Dim data As String() = IO.File.ReadAllLines(storageFile)
Dim systemName As String = data(4).Substring(14)
Dim systemID As String = data(6).Substring(12)
Dim systemModel As String = data(8).Substring(15)
Dim systemSerialNumber As String = data(14).Substring(23)
Dim cpuCount As String = data(30).Substring(23)
Dim memorySize As String = data(32).Substring(14)
'fileString &= storageFile.ToString
'fileString &= vbCrLf
txtTest2.Text = systemName & vbCrLf & systemID & vbCrLf & systemModel & vbCrLf & systemSerialNumber & vbCrLf & cpuCount & vbCrLf & memorySize