need help with this code

Last post 05-18-2008 12:33 AM by in2minds. 5 replies.

Sort Posts:

  • need help with this code

    05-16-2008, 1:27 PM
    • Loading...
    • in2minds
    • Joined on 11-13-2007, 4:11 PM
    • Posts 40

    hello,

    i am converting a C# 2008 web application to vb 2008. I have managed to work with all codes except one:

    How do you do this in VB code?  i dont know how to pass "this" 

    i tried using byval identity as System.Security.Principal.IIdentity
    but what happes to "this" which is being passed?public static string GetFormattedUserName(this System.Security.Principal.IIdentity identity)

    {

    }

    public static Control GetControl(this Control control, string controlId, bool searchChildren)

    {

    }

    thanks

     

    MM

  • Re: need help with this code

    05-16-2008, 3:25 PM

    Me is the VB.net equivalent of this.

    --------------------------------------------------------
    Don't forget to click "Mark as Answer" on the post(s) that helped you.

    Scott ASP.net blog

  • Re: need help with this code

    05-16-2008, 3:46 PM
    • Loading...
    • sreejan
    • Joined on 05-01-2008, 2:14 PM
    • Posts 26

    there are many code coverter tools available

     

    I got this

    --------------------------------

    Public Shared Function GetFormattedUserName(ByVal System.Security.Principal.IIdentity As Me) As String
     
    End Function
     
    Public Shared Function GetControl(ByVal Control As Me, ByVal controlId As String, ByVal searchChildren As Boolean) As Control
     
    End Function

  • Re: need help with this code

    05-16-2008, 4:09 PM
    • Loading...
    • in2minds
    • Joined on 11-13-2007, 4:11 PM
    • Posts 40

    i know that Me is the equivalent of this in vb, but it didnt work. i even tried ByVal System.Security.Principal.IIdentity As Me but the code didnt work

     

    i guess ill abort this part of code and write my own code.

    thanks

    mehdi

  • Re: need help with this code

    05-17-2008, 3:37 AM
    Answer

    it should be:

    ByVal Me as System.Security.Principal.IIdentity

    not

    ByVal System.Security.Principal.IIdentity As Me

    In your listing above you have the code:

    public static string GetFormattedUserName(this System.Security.Principal.IIdentity identity)
    {

    }

    Should there not be a comma or does it appear exactly like this in the C# application? This syntax is invalid. Is the VB.net code not:

    Public Shared Function GetFormattedUserName(ByVal identity As System.Security.Principal.IIdentity) As String

    End Function

     



     

    --------------------------------------------------------
    Don't forget to click "Mark as Answer" on the post(s) that helped you.

    Scott ASP.net blog

  • Re: need help with this code

    05-18-2008, 12:33 AM
    • Loading...
    • in2minds
    • Joined on 11-13-2007, 4:11 PM
    • Posts 40

    Scott,

    There is no comma in the C# code and it works fine, i was confused as well about not having a comma but again it works in C#.

    Thanks

    MM

Page 1 of 1 (6 items)