Avatar billede Slettet bruger
01. november 2006 - 14:41 Der er 3 kommentarer og
1 løsning

register Mærkelig Fejl Hjælp

Hej. Dette skulle ikke være svært for en der kan VB .NET. Er ikke særlig godt til det. Kan da godt lidt.
Når jeg prøver og køre det program som jeg fandt her så får jeg fejl
http://www.codeproject.com/useritems/registration.asp
Her er et billede af fejlen

http://www.mega-world.net/fejl.JPG

Det er denne vb fil der er fejl i

Time_Arithmetic_Core_Module.vb


Module Time_Arithmetic_Core_Module

    ' /////////////////////////////////////////////////////////////////////////

    ' Basic Time Arithmetic Core Module
    ' Version: 2001.0418.0957
    '
    ' /////////////////////////////////////////////////////////////////////////

    ' =========================================================================
    ' =========================================================================
    ' Compute the Julian Day (JD) number value for given calendar date, local
    ' time of day, time zone, time mode and delta T arguments.
    '
    ' The arguments:
    '
    ' TheDate      = Calendar date in same format as 12 Oct 1234 AD
    '
    ' LT_HHMMSS    = Local time as HH:MM:SS.s
    '
    ' TZDiff_HHMM  = Time zone difference as HH:MM  to add to get UT.
    '                If this value is zero, then local time LT = UT
    '
    ' TimeMODE      = Daylight saving/Summer time mode indicator.
    '                Modes are: STD|DAY|SUM
    '                (DAY and SUM are identical)
    '
    ' DeltaT_HHMMSS = The delta T adjustment as HH:MM:SS.s
    '
    '
    ' NOTES:
    ' Date strings are both case and space insensitive so that
    ' 25dec123bc would be treated as identical to  25 Dec 123 BC.
    ' Spaces are OK if BETWEEN arguments, but not WITHIN arguments,
    ' so "25d ec123bc" would return an error.
    '
    ' The month is represented by the three letter abbreviation of
    ' the given month in English.
    '
    ' This function will automatically select the Julian or Gregorian
    ' calendar mode depending on the given calendar date.

    Public Function JD_Num_For(ByRef TheDate As Object, ByRef LMT_HHMMSS As Object, ByRef TZDiff_HHMM As Object, ByRef TimeMODE As Object, ByRef DeltaT_HHMMSS As Object) As Object
        ' Version: 2001.0403.1224

        Dim D As Single ' Day value
        Dim M As String ' Month value
        Dim y As String ' Year value
        Dim DayFrac As Double ' Sum of time elements as fraction of a day
        Dim TModeAdj As Short ' Adjustment to make to LMT according to TimeMODE

        Dim DS As String ' Full date string argument copy
        Dim Mmm As String ' Month abbreviation:  Jan|Feb|Mar|...|Dec
        Dim Yyyy As String ' Year string with optional BC|AD suffix
        Dim G As Single ' Julian/Gregorian calendar mode flag
        Dim JD As String ' JD number value
        Dim W As String ' Random work

        ' Auxiliary working variables for the inverse JD process.
        ' These variables are used in the reversing process that
        ' checks to see if the given date string argument was a
        ' valid calendar date.

        Dim i As Short
        Dim j As Short
        Dim k As Short
        Dim Q As String
        Dim R As Double
        Dim S As Double
        Dim T As Double
        Dim U As Double
        Dim V As Double

        ' Numerical digits as ASCII characters
        Dim NumChars As String
        NumChars = "0123456789"

        ' Define the 3-letter, English month name abbreviations
        Dim MAbbrevs As String
        MAbbrevs = "JANFEBMARAPRMAYJUNJULAUGSEPOCTNOVDEC"

        ' Reconstructed original input date argument
        Dim OrigDateArg As String

        ' Read input date string argument and force to upper case.
        ' Forcing upper case for all internal work removes all external
        ' case sensitivity because the date string input is converted
        ' into uppercase regardless of the case in which it was entered.
        'UPGRADE_WARNING: Couldn't resolve default property of object TheDate. Click for more: 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="vbup1037"'
        DS = UCase(Trim(TheDate.text))

        ' Report error if negative sign found.  There should be no
        ' negative sign anywhere in the date string argument.
        If InStr(DS, "-") > 0 Then GoTo ERR_OUT

        ' -------------------------------------------------------------------------
        ' Account for daylight saving/summer time mode.  If null, the this mode
        ' defaults to standard time.

        'UPGRADE_WARNING: Couldn't resolve default property of object TimeMODE. Click for more: 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="vbup1037"'
        TimeMODE = UCase(TimeMODE)
        'UPGRADE_WARNING: Couldn't resolve default property of object TimeMODE. Click for more: 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="vbup1037"'
        If TimeMODE = "" Then TimeMODE = "STD"

        'UPGRADE_WARNING: Couldn't resolve default property of object TimeMODE. Click for more: 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="vbup1037"'
        If Left(TimeMODE, 1) <> "D" And Left(TimeMODE, 2) <> "SU" And Left(TimeMODE, 2) <> "ST" And TimeMODE <> "" Then
            'UPGRADE_WARNING: Couldn't resolve default property of object TimeMODE. Click for more: 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="vbup1037"'
            'UPGRADE_WARNING: Couldn't resolve default property of object JD_Num_For. Click for more: 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="vbup1037"'
            JD_Num_For = "ERROR:" & TimeMODE & " = Invalid time mode symbol."
            Exit Function
        End If

        'UPGRADE_WARNING: Couldn't resolve default property of object TimeMODE. Click for more: 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="vbup1037"'
        If Left(TimeMODE, 1) = "D" Or Left(TimeMODE, 2) = "SU" Then TModeAdj = -1
        'UPGRADE_WARNING: Couldn't resolve default property of object TimeMODE. Click for more: 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="vbup1037"'
        If Left(TimeMODE, 1) = "STD" Then TModeAdj = 0

        ' -------------------------------------------------------------------------
        ' Compute fraction of a day equivalent to the sum of the time elements.

        'UPGRADE_WARNING: Couldn't resolve default property of object Day_Frac_For(DeltaT_HHMMSS). Click for more: 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="vbup1037"'
        'UPGRADE_WARNING: Couldn't resolve default property of object Day_Frac_For(TZDiff_HHMM). Click for more: 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="vbup1037"'
        'UPGRADE_WARNING: Couldn't resolve default property of object Day_Frac_For(). Click for more: 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="vbup1037"'
        DayFrac = "0"
        ' -------------------------------------------------------------------------
        ' Read the numerical value of the month day.

        D = Val(DS) : OrigDateArg = Trim(CStr(D)) & " "

        ' -------------------------------------------------------------------------
        ' Extract the three letter month abbreviation from the date string and
        ' determine the corresponding month number M (1 to 12).

        W = ""
        For i = 1 To Len(DS)
            If InStr(NumChars, Mid(DS, i, 1)) = 0 Then Exit For
        Next i
        W = Trim(Mid(DS, i, Len(DS)))
        M = Trim(Left(W, 1) & Mid(W, 2, 2))
        OrigDateArg = OrigDateArg & M & " "
        M = CStr(1 + Int(InStr(1, MAbbrevs, M) - 1) / 3)

        ' -------------------------------------------------------------------------
        ' Extract year part of the date string by searching for the first numerical
        ' character encountered in the year value following the month abbreviation.

        For i = 1 To Len(W)
            If InStr(NumChars, Mid(W, i, 1)) <> 0 Then Exit For
        Next i
        y = Trim(Mid(W, i, Len(W)))

        ' -------------------------------------------------------------------------
        ' If no BC|AD era indicated, then attach AD as default.

        If IsNumeric(y) Then y = y & " AD"

        ' -------------------------------------------------------------------------
        ' Separate BC|AD era symbol from year value, if any.

        'UPGRADE_WARNING: Couldn't resolve default property of object Text_Part_Of(). Click for more: 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="vbup1037"'
        W = Text_Part_Of(y)
        'UPGRADE_WARNING: Couldn't resolve default property of object Num_Part_Of(). Click for more: 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="vbup1037"'
        y = Num_Part_Of(y)

        ' -------------------------------------------------------------------------
        ' If no valid BC|AD era symbol at this point, then return error.

        If W <> "BC" And W <> "AD" Then GoTo ERR_OUT

        ' -------------------------------------------------------------------------
        ' Determine which era symbol applies.

        If W = "AD" Then y = CStr(Val(y)) Else y = CStr(1 - Val(y))
        If CDbl(y) <= 0 Then
            OrigDateArg = OrigDateArg & (1 - CDbl(y)) & " BC"
        Else
            OrigDateArg = OrigDateArg & y & " AD"
        End If

        ' -------------------------------------------------------------------------

        ' Now, the string (OrigDateArg), contains a reconstructed copy of the
        ' original input date argument. It will be used later to determine if the
        ' given date was a valid calendar date.

        ' At this point, the three, normalized, numerical date variables, D, M
        ' and Y, should now be ready for computing the JD number.

        ' ---------------------------------------------------------------
        ' The first step is to compute the JD number according to the old
        ' Julian calendar system.

        k = Int((14 - CDbl(M)) / 12)
        JD = CStr(D + Int(367 * (CDbl(M) + (k * 12) - 2) / 12) + Int(1461 * (CDbl(y) + 4800 - k) / 4) - 32113)

        ' -------------------------------------------------------------------------

        ' Now, auto-select the proper calendar mode. If the date is prior to
        ' 15 Oct 1582, (JD < 2299161) then it applies to the Julian calendar,
        ' otherwise it applies to the modern Gregorian calendar.

        ' The official final date on the old Julian calendar was Thursday,
        ' 4 Oct, 1582, which was followed by the first official date on the
        ' Gregorian calendar, Friday, 15 Oct, 1582.  Any calendar dates input in
        ' the range 5 Oct 1582 to 14 Oct 1582, will return an invalid date error.

        If CDbl(JD) > 2299160 Then JD = CStr(CDbl(JD) - (Int(3 * Int((CDbl(y) + 100 - k) / 100) / 4) - 2))

        ' -------------------------------------------------------------------------

        ' Drop through here and perform an inverse check to test if the input date
        ' argument was valid.

        ' --------------------------------------------------------
        ' If the JD value computed at this stage does not return
        ' the original date entered, when the process is reversed,
        ' then the input date argument was an invalid date because
        ' reversing the process should return the original date
        ' argument.

INV_JD:

        If CDbl(JD) < 2299161 Then G = 0 Else G = 1

        ' -------------------------------------------------------------------------
        ' Compute auxiliary values

        Q = CStr(G * Int((CDbl(JD) / 36524.25) - 51.12264))
        R = G + CDbl(JD) + CDbl(Q) - Int(CDbl(Q) / 4)
        S = R + 1524
        T = Int((S / 365.25) - 0.3343)
        U = Int(T * 365.25)
        V = Int((S - U) / 30.61)

        ' -------------------------------------------------------------------------
        ' Construct the calendar date string

        D = CSng(Trim(CStr(S - U - Int(V * 30.61)))) ' Day of month (1 to 31)
        M = CStr((V - 1) + 12 * CShort(V > 13.5)) ' Month number
        Mmm = " " & Mid(MAbbrevs, 3 * (CDbl(M) - 1) + 1, 3) & " "
        y = CStr(CShort(T - CShort(M < CStr(2.5))) - 4716)
        If CDbl(y) <= 0 Then
            Yyyy = Trim(CStr(1 - CDbl(y))) & " BC"
        Else
            Yyyy = Trim(y) & " AD"
        End If

        ' -------------------------------------------------------------------------
        ' Finally, construct the full date string in the same format
        ' as  "12 Jan 2001 BC|AD"

        Q = D & Mmm & Yyyy

        ' -------------------------------------------------------------------------
        ' Now, compare the constructed date string with the input date argument.
        ' If they are identical, then the original date argument was OK, so return
        ' the computed astronomical JD0 value for 00h on that date.

        If Q = OrigDateArg Then
            'UPGRADE_WARNING: Couldn't resolve default property of object JD_Num_For. Click for more: 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="vbup1037"'
            JD_Num_For = CDbl(JD) - 0.5 + DayFrac
            Exit Function
        End If

        ' -------------------------------------------------------------------------

        ' Otherwise, drop through here and report invalid date error.

        ' -------------------------------------------------------------------------
        ' Return error message for an invalid date.

ERR_OUT:
        'UPGRADE_WARNING: Couldn't resolve default property of object TheDate. Click for more: 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="vbup1037"'
        'UPGRADE_WARNING: Couldn't resolve default property of object JD_Num_For. Click for more: 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="vbup1037"'
        JD_Num_For = "ERROR: """ & Trim(TheDate) & """ = Invalid calendar date"

    End Function

    ' =========================================================================
    ' =========================================================================
    ' This function will return the calendar date string corresponding to the
    ' JD number and return it as a standard date string in the same format
    ' as "1 Jan 2001 BC|AD"
    '
    ' It will automatically account for the Julian/Gregorian calendar system
    ' depending on the JD argument provided.
    '
    ' The (JDE_Value) argument refers to a non-negative astronomical JDE number
    ' It can include the fraction of a day corresponding to the time of day,
    ' but the fraction part will be eliminated.
    '
    '
    ' Technically, the returned date starts at noon by traditional astronomical
    ' convention, but starts at 00h according to the civil calendar.

    Public Function Date_For(ByRef JD_Num As Object) As Object
        ' Version: 2001.0321.052508

        Dim D As Double ' Day (1 to 31)
        Dim M As String ' Month number (1 to 12)
        Dim Mmm As String ' Month abbreviation (Jan to Dec)
        Dim y As String ' Year value
        Dim Yyyy As String ' Year string

        Dim DV As String ' Copy of date string argument

        Dim JD As Object ' JD number
        Dim JG As Short ' Julian/Gregorian calendar adjustment value

        ' Auxiliary working variables
        Dim Q As Double
        Dim R As Double
        Dim S As Double
        Dim T As Double
        Dim U As Double
        Dim V As Double

        ' -------------------------------------------------------------------------
        ' Return error message if JD number argument is not purely numeric.

        'UPGRADE_WARNING: Couldn't resolve default property of object JD_Num. Click for more: 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="vbup1037"'
        'UPGRADE_WARNING: Couldn't resolve default property of object JD. Click for more: 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="vbup1037"'
        JD = Trim(JD_Num)
        If Not IsNumeric(JD) Then
            'UPGRADE_WARNING: Couldn't resolve default property of object JD. Click for more: 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="vbup1037"'
            'UPGRADE_WARNING: Couldn't resolve default property of object Date_For. Click for more: 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="vbup1037"'
            Date_For = "ERROR: " & JD & " = Invalid JD number argument." : Exit Function
        End If

        ' -------------------------------------------------------------------------
        ' Normalize the astronomical JDE argument for noon of the corresponding
        ' calendar date.  This will result in an integer value.

        'UPGRADE_WARNING: Couldn't resolve default property of object JD_Num. Click for more: 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="vbup1037"'
        'UPGRADE_WARNING: Couldn't resolve default property of object JD. Click for more: 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="vbup1037"'
        JD = Int(Val(Trim(JD_Num)) - 0.5) + 1

        ' -------------------------------------------------------------------------
        ' Check if Julian (JG=0) or Gregorian calendar (JG=1) indicated.

        'UPGRADE_WARNING: Couldn't resolve default property of object JD. Click for more: 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="vbup1037"'
        If JD < 2299161 Then JG = 0 Else JG = 1

        ' -------------------------------------------------------------------------
        ' Compute auxiliary values.

        'UPGRADE_WARNING: Couldn't resolve default property of object JD. Click for more: 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="vbup1037"'
        Q = JG * Int((JD / 36524.25) - 51.12264)
        'UPGRADE_WARNING: Couldn't resolve default property of object JD. Click for more: 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="vbup1037"'
        R = JG + JD + Q - Int(Q / 4)
        S = R + 1524
        T = Int((S / 365.25) - 0.3343)
        U = Int(T * 365.25)
        V = Int((S - U) / 30.61)

        ' -------------------------------------------------------------------------
        ' Construct the calendar date string.

        D = CDbl(Trim(CStr(S - U - Int(V * 30.61)))) ' Day of month (1 to 31)
        M = CStr((V - 1) + 12 * CShort(V > 13.5)) ' Month number
        Mmm = " " & Mid("JanFebMarAprMayJunJulAugSepOctNovDec", 3 * (CDbl(M) - 1) + 1, 3) & " "

        ' -------------------------------------------------------------------------
        ' Construct year string in BC|AD format (From 4713 BC upward).

        y = CStr(CShort(T - CShort(M < CStr(2.5))) - 4716)
        If CDbl(y) <= 0 Then
            Yyyy = Trim(CStr(1 - CDbl(y))) & " BC"
        Else
            Yyyy = Trim(y) & " AD"
        End If

        ' -------------------------------------------------------------------------
        ' Finally, construct the full calendar date string in the same format
        ' as  "12 Oct 1234 BC|AD"

        'UPGRADE_WARNING: Couldn't resolve default property of object Date_For. Click for more: 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="vbup1037"'
        Date_For = D & Mmm & Yyyy

    End Function

    ' ==============================================================================
    ' ==============================================================================
    ' Convert JDE value into corresponding universal date and UT.
    ' Result is returned in delimited string in format:  "Dd Mmm Yyyy | HH:MM:SS.s"
    '
    ' JDE values < -0.5 will return an error
    '
    ' NOTE:
    ' This function does not account for time zones or delta T.

    Public Function Date_and_Time_For(ByRef JDE_Val As Object) As Object

        Dim Q, JDE, W As Object

        Dim The_Date As String
        Dim The_Time As String

        'UPGRADE_WARNING: Couldn't resolve default property of object JDE_Val. Click for more: 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="vbup1037"'
        'UPGRADE_WARNING: Couldn't resolve default property of object JDE. Click for more: 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="vbup1037"'
        JDE = CDec(Val(JDE_Val))

        ' Report error if JDE < -0.5
        If JDE < -0.5 Then
            'UPGRADE_WARNING: Couldn't resolve default property of object JDE. Click for more: 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="vbup1037"'
            'UPGRADE_WARNING: Couldn't resolve default property of object W. Click for more: 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="vbup1037"'
            W = "ERROR: " & JDE & " = Invalid JDE value."
            GoTo ERR_OUT
        End If

        ' Compute universal calendar date
        'UPGRADE_WARNING: Couldn't resolve default property of object Date_For(). Click for more: 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="vbup1037"'
        The_Date = Date_For(JDE)
        'UPGRADE_WARNING: Couldn't resolve default property of object JDE. Click for more: 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="vbup1037"'
        'UPGRADE_WARNING: Couldn't resolve default property of object Q. Click for more: 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="vbup1037"'
        Q = JDE - 0.5

        ' Compute UT on date based on fractional part of given JDE value
        'UPGRADE_WARNING: Couldn't resolve default property of object Q. Click for more: 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="vbup1037"'
        'UPGRADE_WARNING: Couldn't resolve default property of object Time_For(). Click for more: 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="vbup1037"'
        The_Time = Time_For(Q - Int(CDbl(Q)))

        ' Return date and time in delimited string
        'UPGRADE_WARNING: Couldn't resolve default property of object Date_and_Time_For. Click for more: 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="vbup1037"'
        Date_and_Time_For = The_Date & "  at " & The_Time

        Exit Function

ERR_OUT:
        'UPGRADE_WARNING: Couldn't resolve default property of object W. Click for more: 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="vbup1037"'
        'UPGRADE_WARNING: Couldn't resolve default property of object Date_and_Time_For. Click for more: 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="vbup1037"'
        Date_and_Time_For = W

    End Function

    ' =========================================================================
    ' =========================================================================
    ' Compute fraction of a day corresponding to a given time string in the
    ' general format  ± HH:MM:SS
    '
    ' The time value may be either positive or negative and uses the
    ' 24 hour format.
    '
    ' The input time argument (HHMMSS) is a bit flexible.
    ' Time may be input in the standard format like  01:23:45 or in an
    ' abbreviated format such as,  01:23
    '
    ' When minutes and seconds are not specified, then they are equated to
    ' zero, so a time string of simply 5, would be read as 05:00:00
    '
    ' The time elements do not have to be double digits for values less
    ' than 10.  A time argument of 5:1:2 is the same as 05:01:02
    '
    ' The most important rule is that any time element specified in the
    ' time argument must be preceded by any higher values.  In other words,
    ' if seconds are to be used, then hours and minutes must also be used,
    ' or if minutes are used, then hours must be used.
    '
    ' As a shortcut, a single colon can be used to indicate a zero value
    ' for specified time element.
    ' For example, 00:00:03 can also be input as ::3  or  ::03 and in similar
    ' fashion, 00:03:00 can be expressed as :3: or as :03:
    '
    ' If a negative time value is used, the negative sign must be the first
    ' character in the string.
    '
    ' Any of the time elements may also be expressed in decimal units, so
    ' 3.5 hours can be simply entered as 3.5  or  123.456 minutes may be
    ' entered as the argument, :123.456 and it would still be correctly
    ' interpreted as equivalent to 02:03:27.36 and the proper fraction of
    ' the day returned.

    Public Function Day_Frac_For(ByRef HHMMSS As TextBox) As Object
        ' Version: 2001.0330.0943

        ' Internal string pointers
        Dim i As Short
        Dim j As Short

        Dim TS As String ' Time string

        Dim S As Object ' Time expressed as seconds
        'UPGRADE_WARNING: Couldn't resolve default property of object S. Click for more: 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="vbup1037"'
        S = CDec(0)

        Dim Sign As Short ' Sign value = ±1
        Sign = 1

        ' -------------------------------------------------------------------------
        ' Read time of day argument

        'UPGRADE_WARNING: Couldn't resolve default property of object HHMMSS. Click for more: 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="vbup1037"'
        TS = Trim(HHMMSS.Text)

        ' -------------------------------------------------------------------------
        ' Account for negative argument

        If Left(TS, 1) = "-" Then
            TS = Right(TS, Len(TS) - 1)
            Sign = -Sign
        End If

        ' -------------------------------------------------------------------------
        ' If argument is null, equate it to 00:00:00

        If TS = "" Then TS = CStr(0)

        ' -------------------------------------------------------------------------
        ' If no colons, then attach zero minutes and seconds.

        If InStr(TS, ":") = 0 Then TS = TS & ":00:00"

        ' -------------------------------------------------------------------------
        ' Mark location of 1st colon.

        i = InStr(1, TS, ":")

        ' -------------------------------------------------------------------------
        ' Mark location of 2nd colon.

        j = InStr(i + 1, TS, ":")

        ' -------------------------------------------------------------------------
        ' If no 2nd colon, then attach 00 seconds.

        If j = 0 Then TS = TS & ":00"
        j = InStr(i + 1, TS, ":")

        ' -------------------------------------------------------------------------

        ' At this point, the time should be in the normalized HH:MM:SS format.

        ' -------------------------------------------------------------------------
        ' Parse the time values and convert into total combined seconds.

        'UPGRADE_WARNING: Couldn't resolve default property of object S. Click for more: 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="vbup1037"'
        S = Val(TS) * 3600.0#
        'UPGRADE_WARNING: Couldn't resolve default property of object S. Click for more: 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="vbup1037"'
        S = S + Val(Mid(TS, i + 1, Len(TS))) * 60
        'UPGRADE_WARNING: Couldn't resolve default property of object S. Click for more: 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="vbup1037"'
        S = S + Val(Mid(TS, j + 1, Len(TS)))

        ' -------------------------------------------------------------------------
        ' Return the equivalent fraction of a day equivalent to time string.

        'UPGRADE_WARNING: Couldn't resolve default property of object S. Click for more: 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="vbup1037"'
        'UPGRADE_WARNING: Couldn't resolve default property of object Day_Frac_For. Click for more: 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="vbup1037"'
        Day_Frac_For = Sign * S / 86400

    End Function

    ' =========================================================================
    ' =========================================================================
    ' Given a fraction of a day value, return equivalent time string in the
    ' standard format  "HH:MM:SS.s"
    '
    ' This module checks for erroneous arguments.
    ' Arguments must be strictly numeric, or an error is returned.

    Public Function Time_For(ByRef Day_Frac As Object) As Object
        ' Version: 2001.0331.0530

        Dim HH As String
        Dim MM As String
        Dim SS As String
        Dim S As Object

        Dim Sign As String

        ' -------------------------------------------------------------------------
        ' Return error if not a pure numeric argument.

        If Not IsNumeric(Day_Frac) Then GoTo ERR_OUT

        ' -------------------------------------------------------------------------
        ' Convert day fraction argument into equivalent seconds.

        'UPGRADE_WARNING: Couldn't resolve default property of object Day_Frac. Click for more: 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="vbup1037"'
        'UPGRADE_WARNING: Couldn't resolve default property of object S. Click for more: 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="vbup1037"'
        S = CDec(Trim(Day_Frac)) * 86400

        ' -------------------------------------------------------------------------
        ' Account for ± sign of argument value.

        'UPGRADE_WARNING: Couldn't resolve default property of object S. Click for more: 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="vbup1037"'
        If S >= 0 Then
            Sign = ""
        Else
            Sign = "-"
            'UPGRADE_WARNING: Couldn't resolve default property of object S. Click for more: 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="vbup1037"'
            S = -S
        End If

        ' -------------------------------------------------------------------------
        ' Compute hours

        'UPGRADE_WARNING: Couldn't resolve default property of object S. Click for more: 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="vbup1037"'
        HH = CStr(Int(S / 3600))
        'UPGRADE_WARNING: Couldn't resolve default property of object S. Click for more: 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="vbup1037"'
        S = S - 3600 * CDbl(HH)

        ' -------------------------------------------------------------------------
        ' Compute minutes

        'UPGRADE_WARNING: Couldn't resolve default property of object S. Click for more: 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="vbup1037"'
        MM = CStr(Int(S / 60))
        'UPGRADE_WARNING: Couldn't resolve default property of object S. Click for more: 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="vbup1037"'
        S = S - 60 * CDbl(MM)

        ' -------------------------------------------------------------------------
        ' Compute seconds to 1 decimal place.

        'UPGRADE_WARNING: Couldn't resolve default property of object S. Click for more: 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="vbup1037"'
        SS = Format(S, "0#.0")

        ' -------------------------------------------------------------------------
        ' Correct for any values of 60

        If Val(SS) = 60 Then MM = CStr(CDbl(MM) + 1) : SS = "00.0"
        If CDbl(MM) = 60 Then HH = CStr(CDbl(HH) + 1) : MM = "00"

        ' -------------------------------------------------------------------------
        ' Format and output the finished time string.

        If CDbl(HH) = 0 Then HH = "00" Else HH = Format(HH, "0#")
        If MM <> "00" Then MM = Format(MM, "0#")
        If SS <> "00.0" Then SS = SS
        Time_For = Trim(Sign & HH & ":" & MM & ":" & SS)
        Exit Function

        ' -------------------------------------------------------------------------
        ' Return any error messages here.

ERR_OUT:
        'UPGRADE_WARNING: Couldn't resolve default property of object Time_For. Click for more: 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="vbup1037"'
        Time_For = "ERROR: Invalid day fraction argument."

    End Function

    ' =========================================================================
    ' =========================================================================
    ' This function reads a string from the beginning (left end) and returns
    ' only the numerical characters.  It stops at the first non-numerical or
    ' space character encountered.  If there is no numeric part, then a null
    ' string is returned.
    '
    ' This function can be used to parse a single string containing a numeric
    ' part followed by a text label or symbol and return the numeric part only.
    '
    ' Since spaces are treated as non-numeric, if two numbers are separated by
    ' a space, only the first number will be returned and everything from the
    ' space onward will be ignored.
    '
    ' The counterpart of this function is the Text_Part_Of() function which
    ' returns the label or symbol following the numeric part.
    '
    ' NOTE: This function does NOT check for valid numbers - only if there are
    ' characters that can be part of a valid numeric string.
    '
    ' Errors should be checked for by the routine(s) using the returned
    ' substring.

    Public Function Num_Part_Of(ByRef Arg_String As Object) As Object

        Dim Q As String
        Dim i As Short

        Dim N As String
        N = "-+.0123456789/"

        'UPGRADE_WARNING: Couldn't resolve default property of object Arg_String. Click for more: 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="vbup1037"'
        Q = Trim(Arg_String)

        ' -------------------------------------------------------------------------
        ' Check if pure numeric string

        If IsNumeric(Q) Then
            'UPGRADE_WARNING: Couldn't resolve default property of object Num_Part_Of. Click for more: 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="vbup1037"'
            Num_Part_Of = Q : Exit Function
        End If

        ' -------------------------------------------------------------------------
        ' Check for blank string

        If Q = "" Then
            'UPGRADE_WARNING: Couldn't resolve default property of object Num_Part_Of. Click for more: 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="vbup1037"'
            Num_Part_Of = "" : Exit Function
        End If

        ' -------------------------------------------------------------------------
        ' Find start of non-numeric part, if any

        For i = 1 To Len(Q)
            If InStr(N, Mid(Q, i, 1)) = 0 Then Exit For
        Next i

        ' -------------------------------------------------------------------------
        ' Return null if single non-numeric character

        If i = 1 And InStr(N, Left(Q, 1)) = 0 Then
            'UPGRADE_WARNING: Couldn't resolve default property of object Num_Part_Of. Click for more: 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="vbup1037"'
            Num_Part_Of = "" : Exit Function
        End If

        Num_Part_Of = Left(Q, i - 1)

    End Function

    ' =========================================================================
    ' =========================================================================
    ' This function returns only the symbol or text label following a numeric
    ' value.  It is the counterpart of the Num_Part_Of() function which will
    ' return the numerical part before it.

    Public Function Text_Part_Of(ByRef Arg_String As Object) As Object

        Dim Q As String
        Dim C As String
        Dim i As Short

        Dim N As String
        N = "-+.0123456789/"

        'UPGRADE_WARNING: Couldn't resolve default property of object Arg_String. Click for more: 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="vbup1037"'
        Q = Trim(Arg_String)

        ' -------------------------------------------------------------------------
        ' Return null if pure numeric string or a null argument.

        If IsNumeric(Q) Or Q = "" Then
            'UPGRADE_WARNING: Couldn't resolve default property of object Text_Part_Of. Click for more: 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="vbup1037"'
            Text_Part_Of = "" : Exit Function
        End If

        ' -------------------------------------------------------------------------
        ' Find end of numeric part, if any.

        For i = 1 To Len(Q)
            If InStr(N, Mid(Q, i, 1)) = 0 Then Exit For
        Next i

        ' -------------------------------------------------------------------------
        ' Return text or symbol characters following the numeric part.

        Text_Part_Of = Trim(Mid(Q, i, Len(Q)))

    End Function

    ' =========================================================================
    ' =========================================================================
    ' Test if a function has returned an error message by checking to see if
    ' the returned string starts with the word "ERROR".
    '
    ' Result = Boolean True if error was found or False if no error.

    Public Function Error_In(ByRef Test_Arg As Object) As Boolean
        'UPGRADE_WARNING: Couldn't resolve default property of object Test_Arg. Click for more: 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="vbup1037"'
        Error_In = (InStr(UCase(Test_Arg), "ERROR") > 0)
    End Function
End Module



Det er det lille stykker her der er fejl i som i også kan se på billedet.

JD_Num_For = "ERROR: """ & Trim(TheDate) & """ = Invalid calendar date"

Ændringen fra typen 'TextBox' til typen 'String' er ikke gyldig.
Avatar billede bernhof Nybegynder
02. november 2006 - 01:38 #1
Der skal højst sandsynligt stå TheDate.Text istedet for bare TheDate:

  JD_Num_For = "ERROR: """ & Trim(TheDate.Text) & """ = Invalid calendar date"

Se om det hjælper.
Avatar billede Slettet bruger
02. november 2006 - 09:51 #2
Det Hjalp ikke så meget nu får jeg ingen fejl, men den åbner programmet i 1 sekund og smækker det ned så det forsvinder men det køre stadig, det forsvinder bare væk. Ligesom det lukker ned: :/

:)
Avatar billede Slettet bruger
04. november 2006 - 23:11 #3
Tråden er lukket fandt selv ud af det.       
JD_Num_For = "ERROR: """ & Trim(TheDate.ToString) & """ = Invalid calendar date"

;)
Avatar billede Slettet bruger
04. november 2006 - 23:12 #4
Ups glemte svar
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
Kurser inden for grundlæggende programmering

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester