Click here to Skip to main content
15,891,867 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi
i need display how many days in a month if i am enter the year and month in textbox and display the days in next box using vb.net in windows application

please help me
Posted
Updated 18-Feb-20 23:13pm

1 solution

You could try the DateTime.DaysInMonth Method[^]
 
Share this answer
 
Comments
Member 8614787 22-Mar-12 5:02am    
Hi I used this code but i got error Following error (Month must be between one and twelve.Parameter name: month) this is my code

Dim year As Integer
Dim month As Integer
Dim days As Integer = System.DateTime.DaysInMonth(year, month) //(Month must be between one and twelve.Parameter name: month)
TextBox7.Text = days
OriginalGriff 22-Mar-12 5:08am    
You could try giving it an actual year and month...

Dim year As Integer = 2012
Dim month As Integer = 2
Dim days As Integer = System.DateTime.DaysInMonth(year, month)
Member 8614787 22-Mar-12 5:15am    
hi,

ya this above code is working correct, but my requirments is enter the value in runtime only inside textbox i give input is 2012,4 means display the no of days in next textbox(30) i think clear my requirments..
OriginalGriff 22-Mar-12 5:23am    
So read the value from the TextBox, use string.Split to break it on the comma, then convert the two numbers to integers with Parse or TryParse.
Member 8614787 22-Mar-12 5:26am    
can you give code to me i am not idea about this one anyway i get the output is no of days in the month can you help me

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