I know this should be really simple but I'm having trouble figuring out the logic.
I have a form that can create scheduled tasks. To create the task the user must complete 3 different sections
Days of Week
Days of Month
Task Command Line
For the Days of Week and Days of Month there are various checkboxes they can check and I assign an Integer to the Tag property of each one.
The Task Command line is a simple textbox
Now, when they click the CREATE TASK button I want to check that they have selected at least one checkbox in the Days of Week and Days of Month sections as well as entered a command line
I was doing this before
But I just realised that this allows them to select any number of checkboxes but leave the command line blank.Code:For Each Ctrl As Control In Me.GroupBox_DaysofMonth.Controls If TypeOf Ctrl Is CheckBox AndAlso DirectCast(Ctrl, CheckBox).Checked Then DaysOfMonthValue = DaysOfMonthValue + CInt(DirectCast(Ctrl, CheckBox).Tag.ToString) End If Next For Each Ctrl As Control In Me.GroupBox_DaysofMonth.Controls If TypeOf Ctrl Is CheckBox AndAlso DirectCast(Ctrl, CheckBox).Checked Then DaysOfWeekValue = DaysOfWeekValue + CInt(DirectCast(Ctrl, CheckBox).Tag.ToString) End If Next If DaysOfMonthValue + DaysOfWeekValue = 0 AndAlso Me.CommandToRun.Text.Equals(String.Empty) Then
Any advice appreciated




Reply With Quote