(As a warning - if at any point you think "umm why don't you just use X to get your 2 column display - I'm all for that! This is the only way I came up with).
I want to end up nice looking display of data on the form like this:
Test 1 Result 1
Test 2 Result 2
Test 3 Result 3
Test 4 Result 4
Test 5 Result 5
And have the option to color the results green (for "pass") and red (for "fail").
If I make a TableLayoutPanel and add 10 labels to it like this:
For i As Integer = 1 To 10 Step 2
'setup first column
'create a new label control, name it, and populate it with the test name
Dim myLabelName As New Label
myLabelName.Name = "lblTest_" + i.ToString + "_name"
myLabelName.Text = "Test " + i.ToString
Me.TableLayoutPanel1.Controls.Add(myLabelName)
'setup second column
'create a new label control, name it, and populate it with the test name
'this will automatically be in the second column because the tableLayoutPanel has two columns
'and items are added like this by default:
'1 2
'3 4
'5 6
Dim myLabelResult As New Label
myLabelResult.Name = "lblTest_" + (i + 1).ToString + "_result"
myLabelResult.Text = "Test " + (i + 1).ToString
Me.TableLayoutPanel1.Controls.Add(myLabelResult)
Next
there is a very awkwardly big space between some of the controls that seems to depend on how big the TableLayoutPanel is.
The TableLayoutPanel does the same thing with all combinations of autosize and autosize mode. It also happens with autoscroll either on or off, because there is not more content than will fit in the table.
Does anyone know to make these labels spaced vertically evenly? (Or, again, a better way to display this type of data to the user?)
Thanks!
Dave