Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. vector

vector

Scheduled Pinned Locked Moved Visual Basic
graphics
5 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    Danisto
    wrote on last edited by
    #1

    given a vector of dates (past dates and future ones), how can one extract a new vector showing remaining future dates from today :((

    C 1 Reply Last reply
    0
    • D Danisto

      given a vector of dates (past dates and future ones), how can one extract a new vector showing remaining future dates from today :((

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      By iterating over the collection and pulling out dates that are in the future ?

      Christian Graus - Microsoft MVP - C++ "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )

      C D 2 Replies Last reply
      0
      • C Christian Graus

        By iterating over the collection and pulling out dates that are in the future ?

        Christian Graus - Microsoft MVP - C++ "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )

        C Offline
        C Offline
        Colin Angus Mackay
        wrote on last edited by
        #3

        It saddens me that some people have such poor logical ability.

        Upcoming FREE developer events: * Developer Day Scotland Recent blog posts: * Different ways to add point data in SQL Server 2008 * Spatial References in SQL Server 2008 My website |

        M 1 Reply Last reply
        0
        • C Colin Angus Mackay

          It saddens me that some people have such poor logical ability.

          Upcoming FREE developer events: * Developer Day Scotland Recent blog posts: * Different ways to add point data in SQL Server 2008 * Spatial References in SQL Server 2008 My website |

          M Offline
          M Offline
          MidwestLimey
          wrote on last edited by
          #4

          On the otherhand I'm feeling fairly secure in my job ..


          I'm largely language agnostic


          After a while they all bug me :doh:


          1 Reply Last reply
          0
          • C Christian Graus

            By iterating over the collection and pulling out dates that are in the future ?

            Christian Graus - Microsoft MVP - C++ "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )

            D Offline
            D Offline
            Danisto
            wrote on last edited by
            #5

            Please see my code below, for some reason it fails. can you help definitions: valdate = date today ipos = an indicator = +1 or -1 depending if a bond was bought or borrowed. notional = amount of bond bought or borrowed d1 = date when bond was launched d2 = date when bond matures freq = frequency of interest repayments coupon = interest rate used to calculate coupon repayments Function bondcashflow(valdate, ipos, notional, d1, d2, freq, coupon) Dim p, m As Integer Dim v() Dim cashflow() ReDim cashflow(2, m) As Variant Dim n As Long n = Application.Round(DateDiff(dateinterval.Day, d1, d2) / 365, 0) * freq For i = 0 To n - 1 If freq = 1 Then v(i) = DateAdd(dateinterval.Year, i, d1) ElseIf freq = 2 Then v(i) = DateAdd(dateinterval.Month, 6 * i, d1) ElseIf freq = 4 Then v(i) = DateAdd(dateinterval.Month, 3 * i, d1) Else: v(i) = DateAdd(dateinterval.Year, 12 * i, d1) End If m = 0 If valdate < v(i) Then m = m + 1 End If Next i p = n - m For k = 0 To p - 1 cashflow(k, 1) = v(m) Do While k < p - 1 cashflow(k, 2) = ipos * coupon * notional Loop Next k cashflow(p - 1, 2) = ipos * (notional + coupon * notional) bondcashflow = cashflow End Function

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups