Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Select items in dud control

Status
Not open for further replies.

21091958

Programmer
Aug 21, 2005
20
GB
I have a domainupdown that displays the 12 month of the year and a nud for the days of the month ( 1 to 31)
i use a select case to select the number of days in each month including the leap year.
For the case 0, 2, 4, 6, 7, 9, 11 i would like the domain dudMonth to display only the months with 31 days
Is there a way of doing this???

Select Case dudmonth.SelectedIndex
Case 0, 2, 4, 6, 7, 9, 11 'months with 31 days
nudDay.Maximum = 31

Case 1
If YearOfBirth.IsLeapYear(CShort(myYear)) Then
nudDay.Maximum = 29
Else : nudDay.Maximum = 28
End If

Case 3, 5, 8, 10 'month with 30 days
nudDay.Maximum = 30

End Select
 
This code works well, but in the following case statement i would like to insert some code so that when you scroll down the months, only the one with 31 days shows

Case 0, 2, 4, 6, 7, 9, 11 'months with 31 days
nudDay.Maximum = 31

For the other cases then the 12 months of the year will show
Thank you
 
To be more explicit to force the user to enter only valid values.
user must enter their date of birth using to numeric control(day and year) and 1 domain control for the month, then their age is calculated.
otherwise if someone enter an invalid e.g31 of june, it returns a runtime error.

cheers
 
Based on your first case statement, if the user selects the month first, then the NumericUpDown control will have its maximum value set correctly - so I'm not sure I understand what you are trying to achieve.

As part of the code in the procedure that has the case statement set the current value of the NumericUpDown to 1 (in case July 31 was selected and then the month changed to June)

Hope this helps.

[vampire][bat]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top