☰
d2jsp
Rules
Help
Forum Gold FAQ
Live Streams
Photo Gallery
Hourly Raffle
Ladder Slasher
Log In
Register
Log In
Register
Account Recovery
Resend Validation Email
d2jsp Forums
>
Off-Topic
>
Computers & IT
>
Programming & Development
> Need Help With Assignment > Visual Basic
Add Reply
New Topic
New Poll
Views: 296
Replies: 3
Track Topic
TwPk
Member
Posts: 3,813
Joined: Sep 5 2010
Gold
:
0.00
#1
Aug 1 2015 09:07pm
The assignment consists of a simple listbox that displays the last day of the month for any given year. Here are the rules. Do not use the Visual basic Date.DaysInMonthbuilt in function as it defeats the coding exercise . Use a maskedtextbox for the year where only numbers can be entered. Pick a year to use as default. I used 1980 in my example. Do not hardcode dates.Loop numbers from 1 to 12. Concatenate the number to /01/ and the year entered. Add a month. This gives you the first day of the next month. Subtract one day (DateAdd function) and now you have the last day of the previous month, without having to worry about leap years. For example the first value in your loop will be 1. Plus one month = 2 (Feb). So 2 & “01” & Year Entered then subtract one 1 day will results in the last day of previous month. This also works for month 12 by adding a month to December first you get the first of January of next year, and once you subtract a day it results in the last day of the year. We all know it’s December 31 but this is an assignment where getting to the correct answer is only good if you calculated the result. Do not hardcode any date. From that point it is just a matter of entering the dates into the listbox and formatting the date output.
spt
Member
Posts: 3,476
Joined: Jul 20 2015
Gold
:
651.00
#2
Aug 1 2015 11:17pm
dang, I don't know vba. I should probably learn it, I know a lot of other things.
carteblanche
Member
Posts: 32,925
Joined: Jul 23 2006
Gold
:
3,804.50
#3
Aug 1 2015 11:20pm
Quote (spt_94 @ Aug 2 2015 01:17am)
dang, I don't know vba. I should probably learn it, I know a lot of other things.
sounds more like vb.net than vba though.
carteblanche
Member
Posts: 32,925
Joined: Jul 23 2006
Gold
:
3,804.50
#4
Aug 2 2015 02:26pm
so. are you going to show us what code you have and what you have problems with? if you have problems with syntax, post pseudocode instead.
Go Back To
Programming & Development
Topic List
Add Reply
New Topic
New Poll
© 2003-2026 d2jsp
Contact