Popular Posts

Mar 9, 2011

After Three Months(C#.NET)

You can find the date after three months. Create a project, Take a windows form.then take two textbox and a button.Type the code behind the button....


            string Today1 = datetextBox.Text;
            //DateTime d = GetDate();

           // MessageBox.Show("After three months:" +d);
            DateTime dateTime;

            if (DateTime.TryParse(Today1, out dateTime))

                DateTime dt;
                dt = Convert.ToDateTime(Today1);
                dt = dt.AddMonths(3);
                addMonthtextBox.Text = dt.ToString();

                MessageBox.Show("InValid Date Time");


        //static DateTime GetDate()
        //     return DateTime.Today.AddMonths(3);

No comments:

Post a Comment