Question
Write Code In Visual Basic: Demonstrate two ways to do the following. Use both a set of IF Then ElseIf and a Select Case statement.
Write Code In Visual Basic:
Demonstrate two ways to do the following. Use both a set of IF Then ElseIf and a Select Case statement.
The task is to generate a message based on the number of days overdue a bill is. I suggest creating a variable to hold the number of days past due and then using that in your comparisons. The user enters a due date into a text box. Compare that date with todays date (you can use the Today() function for that). And then display different messages based on how late the payment is.
0 30 days The account is current.
31 60 days Your account is overdue. Please send a payment
61 90 days -First Warning. Your account is past due. Please address this immediately.
91 120 days Second Warning. This requires your immediate attention. If you do not address this immediately, the bill will be sent to a debt collector.
121 -140 days Final Notice. If we do not receive payment immediately, your account will be sent to a debt collector.
More than 140 days Account Suspended
When you startup, display todays date in the label on the form.
Validate the users input to make sure a valid date is entered (i.e., make sure the code does not crash). You can use the VB function IsDate(). If it is invalid, put the error message in the output label dont use a Messagebox.
Display the appropriate message in the large label when the user hits either the Else If or Select Case button. When the user hits the Else IF button, use Else IF statements. When they hit the Select Case button use Select Case.
When they enter a new date, clear out the output label, and only display something when they press on of the buttons. You will need to use an event linked to the textbox to do this.
Exit the application when they hit the exit button
Comment the code.
Put Your Name Here Invoice Date Today's date Else f Select Case Message ExitStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started