473,387 Members | 1,532 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Multiple Forms bound to same BindingSource

I got a forms library build from a data source with the designer.
I want to use that as a custom widget (sevral instances).
The designer included BindingSources for the controls in my forms
library.

Is there a way to use only one set of BindingSources for several
instances
of the forms?
Other than excluding all the designer generated code concerning the
BindingSource objects and redo it by hand using e.g. static memebers
for the
BindingSource instead.
Is there a way the desinger supports this?

Thanks,
Marc
Nov 27 '07 #1
1 2196
Is there a way the desinger supports this?

The short answer is "no".
using e.g. static memebers for the
BindingSource instead.
Don't go near statics for this; perhaps have an instance property
("public BindingSource DataSource {get;set;}") or method ["public
Bind(BindingSource source)"] would allow you to do this per instance,
but you'd need to wire it up so that after you have created your child-
controls you pass the binding-source over.
You might be able to cut/paste the binding code from the designer.cs
into a private method that sits behind the above; to be honest, I
would do this last step regardless, simply because the designer has a
distressing habit of losing bindings whenever it has a panic. If they
are in *your* code it is harder for the IDE to mess it up. But it
means you don't get quite as pretty a design-time experience (but
then: I care more for what happens at execution that what it looks
like in the IDE).

Marc
Nov 27 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: TheMadHatter | last post by:
I have an array of a custom obj which I am trying to use in multiple comboBoxes without creating multiple copies, but if I put the datasource of the comboboxes to the same array, then at runtime...
1
by: Felipe Roucher | last post by:
Hello, I 've a Windows Form and a "DataGridView" with the "DataSource" binding with a "BindingSource" and a "BindingNavigator", in the other hand in the same Form, there's multiples textbox's...
3
by: michael sorens | last post by:
I have generated an XmlDocument, then bound it to a DataGridView (thanks to a pointer from PeterBromberg in a separate, recent posting). Now I want to connect a BindingNavigator, but my rudimentary...
5
by: njb35 | last post by:
Hi all I'm beginning my foray from VBA into VB 2005 Express, and enjoying some of the efficiencies it provides! I'm stuck with some dataset handling however that I _think_ can be automated but...
4
by: sklett | last post by:
(I posted this in a databinding NG, but it's a VERY low traffic NG so I thought I would post here as well. I hope no one minds too much, if you do I'm sorry) I have a DGV that is bound to a...
6
by: =?Utf-8?B?TU1TSkVE?= | last post by:
How to let user delete multi rows from the BindingSource while the SelectionMode Property set to RowHeaderSelect I have in my program datagridview bound it to sql table Throw Bindingsource To...
2
by: jehugaleahsa | last post by:
Hello: I'm working on improving some of our Windows Forms. I have created two user controls that I want to bind to the same BindingSource. I have an overview control that is used just to...
5
by: Ashutosh | last post by:
Hi, I have a un-typed table and 5 combo box on the form. All these combo box have this table as the data source. Now I want to be able to select different values using the 5 combo box. But when I...
4
by: sree078 | last post by:
I've a list of items which I bound to multiple combo boxes. In the due course in the code...I had to add an item into one combo box...but I don't want it to be reflected into any other combo...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.