I have two textbox to let user input start date and end date. Then I have a checkbox that allow user to check to see some calculations. My question is, how can I disable the checkbox if the duration between start date and end date is shorter than a specific length. I mean, right after user input the start date and end date, he/she would see the checkbox is disabled because the time period length is not long enough.
if (productWealth.Count < 3)
    checkBox7.Enabled = false;
This is what I have now, if count < 3, then checkbox 7 is disabled. Seems like the application only run the count when run click the RUN button, but I want them to see immediate effect.
You can use the event TextChanged, so when the user change the value of the TextBox you check if its true and enable the CheckBox.
tboxEndDate.TextChanged += new TextChangedEventHandler(tboxEndDate_TextChanged);
void tboxEndDate_TextChanged(object sender, TextChangedEventArgs e)
{
   // Calcule the productWealth
   if (productWealth.Count < 3) checkBox7.Enabled = false;
}
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With