Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm Data Binding / October 2006

Tip: Looking for answers? Try searching our database.

How can I bind a control to an object declared at run time?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jamie Risk - 26 Oct 2006 20:44 GMT
I'm so lost.  This has to be the 20th attempt at writing this
posting.

  * I have a form with various controls.
  * I have an object with associated properties
    (accessible with get/set type of interface).
  * I'd like to have the controls manipulate the
    properties of the object.

Is there a way to avoid manually coding event handlers for each
of control on the form to do this?

In order to modify the (DataBindings)/Text property of say, a
textBox in the form design view I have to add data source to my
solution.  Doing so gives me an option to select an 'object' as
the data source, but then I'm given only a selection of class
definitions.

How am I supposed to do this?  What should I be Googling to give
me an inkling of clue?

- Jamie
Bart Mermuys - 26 Oct 2006 21:43 GMT
Hi,

> I'm so lost.  This has to be the 20th attempt at writing this posting.
>
[quoted text clipped - 11 lines]
> gives me an option to select an 'object' as the data source, but then I'm
> given only a selection of class definitions.

So use the class DataSource to setup the bindings with the Designer.  Note
that it will also put a BindingSource on the Form, then at runtime do:

YourBindingSource.DataSource  =  yourObject;

HTH,
Greetings

> How am I supposed to do this?  What should I be Googling to give me an
> inkling of clue?
>
> - Jamie
Jamie Risk - 27 Oct 2006 14:55 GMT
This was what I was exactly what I needed.  A thousand thanks.

- Jamie

p.s. Now I've got my answer, I'm going to try and figure out
where I missed it in the documentation.

>> I'm so lost.  This has to be the 20th attempt at writing this posting.
>>
[quoted text clipped - 19 lines]
> HTH,
> Greetings
Otis Mukinfus - 28 Oct 2006 18:44 GMT
>This was what I was exactly what I needed.  A thousand thanks.
>
[quoted text clipped - 26 lines]
>> HTH,
>> Greetings

If you want the bound objects to be editable they will need to use the IEditable
and INotifyPropertyChanged interfaces.  Check the help on those two
interfaces...
Good luck with your project,

Otis Mukinfus
http://www.arltex.com
http://www.tomchilders.com
Otis Mukinfus - 28 Oct 2006 18:49 GMT
>This was what I was exactly what I needed.  A thousand thanks.
>
[quoted text clipped - 26 lines]
>> HTH,
>> Greetings

AW Shoot, Jamie!

I should have said IEditableOject in my previous post.  I make that mistake all
the time ;o)
Good luck with your project,

Otis Mukinfus
http://www.arltex.com
http://www.tomchilders.com

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.