Results 1 to 2 of 2

Thread: [2008] How do I find the datamember?

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    May 2006
    Location
    Manchester, England
    Posts
    255

    [2008] How do I find the datamember?

    Hi,
    I'm using the following to bind to a TextBox:
    Code:
    Me.txtDescription.DataBindings.Add(New Binding("Text", myBind, "description"))
    However, at run time, I need to be able to determine what the dataMember is for txtDescription elsewhere in the code. How do I get at it?
    At home - VB.NET 2005/2008 Express, Visual Web Developer 2005 Express
    At work - VS 2008 Standard (VB)
    .NET 2.0/3.5


    Visual Studio Express Learning Centre | How do I videos | MSDN VB Express Forum | MSDN VB Developer Centre

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

    Re: [2008] How do I find the datamember?

    That code adds a new Binding object to the TextBox's DataBindings collection. You can get that Binding back from that collection by indexing it by property name, i.e.
    vb.net Code:
    1. Dim textBinding As Binding = Me.txtDescription.DataBindings("Text")
    You can then get all the information you need from the properties of that object.
    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