I have a simple problem, and my solution works… more or less…
Here’s the problem:
I scan a master folder looking for data. These data are saved in an html file.
At the start of the html document, I set an href table in four columns.
To achieve that, I cound the number of “valid” folders inside the master folder. This value is stored inside Total_Cnt. Because I want to store the references inside 4 columns, I created another variable to hold the number of entries in that table: Loc_Row = Ceil(Total_Cnt / 4).
In the data creation flow, I create and store the entries and increment a special variable Loc_Cnt. I have an If block to deal with the href links:
If Loc_Row = Row_Cnt Then // See (*) below
// Add a brand new Row
// Reset Loc_Row to 0
Else
// Increment the Loc_Row (# of Rows in each Column)
Loc_Row = Loc_Row + 1
End If
(*) Using > instead of = leads to troubles too depending on the Total_Cnt value. I tried >= too, but it is also troublesome.
Changing Ceil by Floor may lead to the creation of a 5th column.
As is (using >), the program, depending on the Total_Cnt value, may lead in errors too.
As a variation, I also noted 4 more rows in Columns 1, 2 and 3 than in Column 4 !
In short, the relevant part of the code flow is:
Total_Cnt = Master_FI.Count
Loc_Row = Ceil(Total_Cnt / 4)
For i = 1 to Total_Cnt
// Do some stuff
// Build the “<table…” block:
// Add a “<a href=” line into a Variable for later use
// Determine if I add a New Column or stay in the current one
If Loc_Row = Row_Cnt Then // See (*) below
// Add a brand new Row
// Reset Loc_Row to 0
Else
// Increment the Loc_Row (# of Rows in each Column)
Loc_Row = Loc_Row + 1
End If
// Do some more stuff
Next
// Locate where to place the “<table…” data
// Insert the “<table…” string in the TextArea
Can you tell me what’s wrong in the code design ?
There is a button to save the TextArea Contents nto an html file.
There is another button to render the html from TextArea into an HTMLViewer.