Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • javier 59 posts 79 karma points
    Jun 14, 2010 @ 16:08
    javier
    0

    retrieve member info in vb.net

    Hi,

    I'm stuck again :S.

    I'm creating a user control to access information from a db. In the members type, I added a property (userid). The idea is ro read that information when the user logs in the site and use it to query the db.

    My testing  user control (vb.net) have a button and a label. When the button is pressed, the userid should show in the label. I have this code:

     

    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button1.Click

     

    Dim n As umbraco.cms.businesslogic.member.Member

    Label1.Text = n.getProperty(

    "UserId").Value.ToString

     

    End Sub

    The error I recive is (translated using google, because my message is in spanish):

    Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

     Looks like the object "n" is empy.  

    Any ideas?

     

    Thanks


    Javier

  • Petr Snobelt 923 posts 1535 karma points
    Jun 14, 2010 @ 16:30
    Petr Snobelt
    0

    Hi, you declare object, but don't create it with something like this

    n = umbraco.cms.businesslogic.member.Member.getCurrent()
  • javier 59 posts 79 karma points
    Jun 14, 2010 @ 17:12
    javier
    0

    Thanks for the answer.

    That didn't work. 'getCurrent()  not member of  umbraco.cms.businesslogic.member.Member'

    I tried with  n = umbraco.cms.businesslogic.member.Member.GetCurrentMember()

    but still same error.

  • Peter Dijksterhuis 1442 posts 1722 karma points
    Jun 14, 2010 @ 17:59
    Peter Dijksterhuis
    0

    try

    umbraco.library.GetCurrentMember()

    Peter

  • javier 59 posts 79 karma points
    Jun 14, 2010 @ 21:06
    javier
    0

    Hi Peter,

    I recive this:

    Value of type 'System.Xml.XPath.XPathNodeIterator' cannot be converted to 'umbraco.cms.businesslogic.member.Member'. 

    I asume the object declaration also need to be changed, but dont know to what.

    Thanks

     

    Javier

  • javier 59 posts 79 karma points
    Jun 14, 2010 @ 22:30
    javier
    0

    I remove all the lines and leave only

    Label1.Text = umbraco.library.GetCurrentMember().ToString

    that gives as answer the value

    MS.Internal.Xml.XPath.XPathSelectionIterator  

    I'm still lost :S

     

     

  • javier 59 posts 79 karma points
    Jun 14, 2010 @ 23:10
    javier
    0

    this is so embarrassing .... I didn't login :/

    Now it works. lol

Please Sign in or register to post replies

Write your reply to:

Draft