Click here to Skip to main content
15,886,724 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I want to write a condition on how to disable a name of a person that has been selected from combobox from being selected again until a specific date and the name can be enabled.
Thank you.

What I have tried:

Between if statement and while statement. I don't know which which one to use.
Posted
Updated 27-Apr-22 23:55pm
Comments
Maciej Los 28-Apr-22 14:19pm    
"What i have tried section" is for the snippet of code you used to resolve your issue.

1 solution

Quote:
Between if statement and while statement. I don't know which which one to use.

Simple:
If you have one item to work on, you use if
If you have a number of items to work on, you use while

if checks the condition once, and once only.
while continues to loop until the condition is false.
C#
if (myInteger == 666) Foo();

C#
while (GetNextItem() == 666) Foo();
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900