d2jsp
Log InRegister
d2jsp Forums > Off-Topic > Computers & IT > Programming & Development > Need Help With Assignment > Visual Basic
Add Reply New Topic New Poll
Member
Posts: 3,813
Joined: Sep 5 2010
Gold: 0.00
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. D​o not use t​he Visual basic D​ate.DaysInMonth​built 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. D​o 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.
Member
Posts: 3,476
Joined: Jul 20 2015
Gold: 651.00
Aug 1 2015 11:17pm
dang, I don't know vba. I should probably learn it, I know a lot of other things.
Member
Posts: 32,925
Joined: Jul 23 2006
Gold: 3,804.50
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.
Member
Posts: 32,925
Joined: Jul 23 2006
Gold: 3,804.50
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