Results 1 to 4 of 4

Thread: reflection error

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2006
    Posts
    3

    reflection error

    hi,
    i'm having error "Member not found." from the following code(in time of invoking member)..

    Code:
    foreach (MemberInfo mi in type.GetMember("test_mdi_Init"))
    {
      type.InvokeMember (mi.Name.ToString(), 
      BindingFlags.Default | BindingFlags.InvokeMethod,
      null,
      ibaseObject,
      arguments);
    }
    what could be the problem? thanx for help

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: reflection error

    I'm guessing that MethodInfo.Name is not giving you the correct value to pass to InvokeMember. Try using the Invoke method of the MethodInfo object instead.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    New Member
    Join Date
    Mar 2006
    Posts
    3

    Re: reflection error

    Err... No, that actually passed the right value. i'v made mistake. i didn't make the method as 'static'. later i read on MSDN that i must do that, so now it's working fine. sorry for my bad , and thanks for helping me

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: reflection error

    Cool, that makes sense. Don't forget to resolve your thread from the Thread Tools menu.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width