Processing Ajax...

Title
Close Dialog

Message

Confirm
Close Dialog

Confirm
Close Dialog

Confirm
Close Dialog

Decrement Value

Description
Takes a numeric or date value and decrements it. Numeric values are decremented by 1. Date values are decremented by a single day.
Language
VB.net
Minimum Version
Created By
wooster11
Contributors
-
Date Created
Aug 19, 2014
Date Last Modified
Aug 19, 2014

Macro Code

Imports System
Imports System.Windows.Forms
Imports Microsoft.VisualBasic

Public Class ClipboardFusionHelper

    Public Shared Function ProcessText(text As String) As String
        BFS.Clipboard.PasteText(text)
        If IsNumeric(text) Then
          Dim x As Double = CDbl(text)
         x -= 1
         text = x.ToString()
        ElseIf IsDate(text) Then
          Dim x As DateTime
         x = CDate(text)
         x = x.AddDays(-1.0)
         text = x.ToString("yyyy-MM-dd HH:mm:ss")
        Else
          MessageBox.Show("Clipboard text is invalid.  It must be numeric or a date", "Decrement Value", MessageBoxButtons.OK, MessageBoxIcon.Information)
        End If

        Return text
    End Function

End Class