Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. LINQ
  4. error BindingSource.current using linq [modified]

error BindingSource.current using linq [modified]

Scheduled Pinned Locked Moved LINQ
helpcsharpwpfwcflinq
3 Posts 2 Posters 2 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • W Offline
    W Offline
    Widgets
    wrote on last edited by
    #1

    hi all i having a problem using linq with may binding source. i coded it in this way. dim MyBindingSource as new BindingSource() dim CustomerList = FROM customer In MyDataContext.tblCustomer _ SELEC customer.CustomerID, customer.CustomerName MyBindingSource.DataSource = CustomerList msgbox (MyBindingSource.Current("CustomerID") error occur on msgbox (MyBindingSource.Current("CustomerID") line? it says "No default member found of type '<>f__AnonymousType0`11[System.String, .etc What should i do.. Please help thanks..

    modified on Monday, April 26, 2010 1:05 AM

    W S 2 Replies Last reply
    0
    • W Widgets

      hi all i having a problem using linq with may binding source. i coded it in this way. dim MyBindingSource as new BindingSource() dim CustomerList = FROM customer In MyDataContext.tblCustomer _ SELEC customer.CustomerID, customer.CustomerName MyBindingSource.DataSource = CustomerList msgbox (MyBindingSource.Current("CustomerID") error occur on msgbox (MyBindingSource.Current("CustomerID") line? it says "No default member found of type '<>f__AnonymousType0`11[System.String, .etc What should i do.. Please help thanks..

      modified on Monday, April 26, 2010 1:05 AM

      W Offline
      W Offline
      Widgets
      wrote on last edited by
      #2

      I've seen a solution for this problem from other person with same problem as it is: Add "System.Web" to may references then imports System.Web.UI then by using DataBinder such this: msgbox (DataBinder.eval(MyBindingSource.Current(), "CustomerID")) but another problem pop up.. when i use the addnew method of my bindingsource an error halted me.. saying that my list is readonly and has no way to execute my addnew... MyBindingSource.Addnew() Please help! thanks in advance...

      1 Reply Last reply
      0
      • W Widgets

        hi all i having a problem using linq with may binding source. i coded it in this way. dim MyBindingSource as new BindingSource() dim CustomerList = FROM customer In MyDataContext.tblCustomer _ SELEC customer.CustomerID, customer.CustomerName MyBindingSource.DataSource = CustomerList msgbox (MyBindingSource.Current("CustomerID") error occur on msgbox (MyBindingSource.Current("CustomerID") line? it says "No default member found of type '<>f__AnonymousType0`11[System.String, .etc What should i do.. Please help thanks..

        modified on Monday, April 26, 2010 1:05 AM

        S Offline
        S Offline
        SeanKuehnel
        wrote on last edited by
        #3

        Hi, The context of which you are using to try and get the customerId is incorrect, the reason is because the current item that you are trying to get data from is an anonymous type. This type doesn't have any default members like the exception states. Unfortunately, I don't have any exact support for this sample code you put, but if you were using a real type (even if you made the type yourself using a custom class) you could typecast the item contained in MyBindingSource.Current to retrieve the data from it correctly. hope this helps

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups