CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    May 2001
    Location
    Silicon Valley
    Posts
    113

    Question newbie WinForms DataBinding question

    Folks,

    I’m doing my first project with WinForms, and I’m trying to get the DataBinding working. There’s no database in my project, but I’d like to bind some of the TextBoxes to runtime object properties. On the web I found the following line of code which “does it”:

    Code:
    textBox2.DataBindings.Add(new Binding("Text", this.myPerson, "LastName"));
    This is a viable approach for me. However, my question is – can data binding to runtime object properties be done during design time (without writing code) ? If so, how?

    Any suggestions references and insight is appreciated!

    Cheers,
    - Nick

  2. #2
    Join Date
    Nov 2002
    Location
    .NET 3.5 VS2008
    Posts
    1,039

    Re: newbie WinForms DataBinding question

    Quote Originally Posted by kender_a
    This is a viable approach for me. However, my question is – can data binding to runtime object properties be done during design time (without writing code) ? If so, how?
    I'm not entirely sure what you mean by this. The example you shown should answer the question. You probably need to clarify what you mean by 'runtime object properties' and clarify what you mean by 'without writing code'. You can use the Visual Studio designer tools to set up the data binding but you would need to know what you are binding to at design time.

  3. #3
    Join Date
    May 2001
    Location
    Silicon Valley
    Posts
    113

    Re: newbie WinForms DataBinding question

    Quote Originally Posted by nelo View Post
    You can use the Visual Studio designer tools to set up the data binding...
    That's what I'm looking for. I know the name of the object (of my own class) and the property. How can I set-up the binding using Visual Studio designer tools?

    P.S. I know how I would set up this binding if I were using WPF, but I'm forced to use WinForms.

Tags for this Thread

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

Featured