Click here to Skip to main content
15,921,351 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
i have one datetimepicker and two textbox , on firsttext box i want to give month like 6or 12 then on the second textbox the value will be datetimepickervalue + 6 months or 12 months ,Suppose today is 02-Feb-2014 then if you type 12 on first textbox then on 2nd textbox it will show 02-Feb-2015 ,Please Give the code in vb.net
Posted

We do not do your homework: it is set for a reason. It is there so that you think about what you have been told, and try to understand it. It is also there so that your tutor can identify areas where you are weak, and focus more attention on remedial action.

Try it yourself, you may find it is not as difficult as you think!

This isn't difficult: give it a go! If you get stuck, ask about a specific problem, but we aren;t going to just "give you the code".
 
Share this answer
 
try this
VB
Dim dt As Date = DateTimePicker1.Value
        dt = dt.AddMonths(TextBox1.Text)
        TextBox2.Text = dt
 
Share this answer
 
VB
Me.TextBox2.Text = Me.DateTimePicker1.Value
Dim m_date As DateTime
Dim m_result As DateTime
m_date = CDate(TextBox2.Text)
m_result = m_date.AddMonths(CInt(TextBox1.Text))
 
Share this answer
 

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