.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Pankaj Mishra
alex morco
Imran Ghani
Post New Web Links

Need Help in c#

Posted By:      Posted Date: August 27, 2010    Points: 0   Category :ASP.Net

i am very new in c#.below is one of my function which return the Academic Year of given date.

i do it in vb.net and it is working fine.i need to do it in c# becuase now my current project is in c#.when i try it to convert it in c# and run it not working.
the Month function is not found in c#. like other Method also.
please some one hemp me to solved it.

Function in vb.net

Function FnYear(ByVal VDATE As Date) As String
        If Month(VDATE) <= 0 Then

            ' ClientScript.RegisterStartupScript(GetType(Page), "alert", "<script language=JavaScript>alert('" & ("Enter Valid Month.....!") & "');</script>")
            ScriptManager.RegisterStartupScript(Me, GetType(Page), UniqueID, "alert('Enter Valid Month.....!')", True)
            FnYear = ""
            Exit Function
        End If
        If Month(VDATE) > 5 Then
            FnYear = Right(Year(VDATE), 2) & "-" & Right(Year(VDATE) + 1, 2)
        ElseIf Month(VDATE) <= 5 Then
            FnYear = Right(Year(VDATE) - 1, 2) & "-" & Right(Year(VDATE), 2)
        End If
    End Function
i use it like

View Complete Post

More Related Resource Links

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend