-1

I mean, how to write formula like this:

Dec2013-Feb2014, the result = 3 (from december to february, jump 3 time)

Jan2014-Feb2014, the result = 2 (from january to february, jump 2 time)

Feb2014-Feb2014, the result = 1 (in same month is 1 time) 

then i have

  • TextBox1.text -> as month before

  • TextBox2.text -> as month after

  • TextBox3.text -> as the result

  • Button1.text, button to get the result in the Textbox3.Text

If I write TextBox1.text = "20-May-2012", TextBox2.text = "20-Feb-2014", I wanna TextBox3.Text = 22.

If I write TextBox1.text = "20-May-2013", TextBox2.text = "20-Feb-2014", I wanna TextBox3.Text = 10.

If I write TextBox1.text = "20-Dec-2013", TextBox2.text = "20-Feb-2014", I wanna TextBox3.Text = 3

If I write TextBox1.text = "20-Jan-2013", TextBox2.text = "20-Feb-2014", I wanna TextBox3.Text = 2

If I write TextBox1.text = "10-Feb-2013", TextBox2.text = "20-Feb-2014", I wanna TextBox3.Text = 1

and so on.

how could i write the month jumping formula?

Ameya Deshpande
  • 3,580
  • 4
  • 30
  • 46
valzz
  • 19
  • 1
  • 1
  • 5

1 Answers1

1

You can do by datediff function in VB.NET

Dim datTim1 As Date = TextBox1.Text
Dim datTim2 As Date = TextBox2.Text

Dim wD As Long = DateDiff(DateInterval.Month, datTim1, datTim2)

TextBox3.text = wD
Ameya Deshpande
  • 3,580
  • 4
  • 30
  • 46