Databinding between two forms in .NET 2.0

  • Thread starter Henrik Skak Pedersen
  • Start date
H

Henrik Skak Pedersen

Hi,

I would like to data bind two different forms with each other. I would like
to have employees on the first form and orders on the second. When the
selected employee changes, the orders should change two. It is easy to do on
a single form where you can add a new bindsource which points to the
relation. But how can I do this across forms?

I have tried to do it manually where I am passing the BindingSource and the
DataSet, but then I cant use the designers.

What is the best way to do this?

Regards

Henrik Skak Pedersen.
 
N

Neil Ni

Hi,

The designer does not supply a wizard for cross-form databinding.

If the two forms are in the same application.
You can write a new Event on Form A and Fire It when the user selects a new
data source.
Form B would subscribe to this Event and in the event handling method it
would receive the new Data Source and use it to refresh the Grid.

Other way would be if you open Form B from Form A, then in the constructor
of Form B you can pass the value of the new data source, although if you
ever change the value in form A then you would have to create a new
instance of FormB.

I think the first way is the best.


Thanks & Regards,

Neil Ni
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security

When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.

=====================================================
Business-Critical Phone Support (BCPS) provides you with technical phone
support at no charge during critical LAN outages or "business down"
situations. This benefit is available 24 hours a day, 7 days a week to all
Microsoft technology partners in the United States and Canada.

This and other support options are available here:

BCPS:
https://partner.microsoft.com/US/technicalsupport/supportoverview/40010469

Others: https://partner.microsoft.com/US/technicalsupport/supportoverview/

If you are outside the United States, please visit our International
Support page:
http://support.microsoft.com/default.aspx?scid=/international.aspx.
=====================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
 
N

Neil Ni

Hi,

It's my pleasure to work with you. Do you need any more help on this case?


Thanks & Regards,

Neil Ni
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security

When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.

=====================================================
Business-Critical Phone Support (BCPS) provides you with technical phone
support at no charge during critical LAN outages or "business down"
situations. This benefit is available 24 hours a day, 7 days a week to all
Microsoft technology partners in the United States and Canada.

This and other support options are available here:

BCPS:
https://partner.microsoft.com/US/technicalsupport/supportoverview/40010469

Others: https://partner.microsoft.com/US/technicalsupport/supportoverview/

If you are outside the United States, please visit our International
Support page:
http://support.microsoft.com/default.aspx?scid=/international.aspx.
=====================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top