I have this form that contains a GroupBox, and in this GroupBox are some Labels and a CheckBox. The CheckBox is set to 'Checked' in design-time, which means when it loads that defaults to 'Checked'. Hence when a new instance of this form is created, the CheckChanged event for that check box fires before the Form's Load event. The Text values of the labels depend on whether the check box is checked or not.
This is in the CheckChanged event for the check box, which fires before the Form's Load event:
If chkUseAsFull.Checked Then
fraHalf.Text = "Full Spacing"
lblLitHalfSpacing.Text = "Spacing"
lblLitHalfSpeed.Text = "Speed"
txtHalfSpacing.Text = txtSpacing.Text
txtHalfSpacing.Enabled = False
cmdAdjustHalf.Enabled = False
Else
fraHalf.Text = "Half Spacing"
lblLitHalfSpacing.Text = "1/2 Spacing"
lblLitHalfSpeed.Text = "1/2 Speed"
txtHalfSpacing.Text = Format(spc, "##0.00")
txtHalfSpacing.Enabled = True
cmdAdjustHalf.Enabled = True
End If
fraHalfis the group box, andlblLitHalfSpacingandlblLitHalfSpeedare labels within it.
Note that in design-time, the Text values of the group box and labels are those specified when the check box is NOT checked.
But when I launch this form, the group box's Text is "Full Spacing" but the labels' Text is "1/2 Spacing" and "1/2 Speed".
Why would the text of the group box show according to the check box's checked value correctly, but not the text of those labels?
Aucun commentaire:
Enregistrer un commentaire