2012-03-12 109 views
1

我在這裏有一些問題,我不太清楚如何處理它。如果你能導致我在正確的方向,這將不勝感激:'公共函數'沒有類型參數,所以不能有類型參數。 VB.NET

Private Function Convert2YearTo4Year(ByVal str_DTG2Year As String) As String 

    Dim str_sys4Year As String 
    Dim i_sys2Year As Integer 
    Dim i_sys2Century As Integer 

    str_sys4Year = Right(Str$(Of Date), 4) 
    i_sys2Year = Val(Right(str_sys4Year, 2))   'value of system 2-digit yr 
    i_sys2Century = Val(Left(str_sys4Year, 2))   'value of system 2-digit century 

    If Val(str_DTG2Year) < i_sys2Year And i_sys2Year - Val(str_DTG2Year) > 50 Then   'next century 
     Convert2YearTo4Year = Trim$(Str$(i_sys2Century + 1) + str_DTG2Year) 
    ElseIf Val(str_DTG2Year) > i_sys2Year And Val(str_DTG2Year) - i_sys2Year > 50 Then  'prev century 
     Convert2YearTo4Year = Trim$(Str$(i_sys2Century - 1) + str_DTG2Year) 
    Else 
     Convert2YearTo4Year = Trim$(Str$(i_sys2Century) + str_DTG2Year)       'current century 
    End If 
End Function 

在這篇文章的標題中的錯誤在權(力量$(過期),4)下垂。

回答

4

刪除Of
Of用於傳遞泛型類型參數。

您應該用DateTime.Now.Year替換整行。

相關問題