-
Feb 27th, 2013, 08:03 PM
#1
Data Binding stuffing up through Designer???
I drag a field in from the datasources and it creates a bindingsource for it in the components section and binds the text field to it... when I then drag another filed from the same datasource onto the form it then creates another bindingsource for this filed instead of using the existing one???
Also on further inspection databindings/text property for the textbox is: "ResTreatmentsBindingSource1 - Desc", but when i drop down the property editor, i cannot expand the bindingsource's (ResTreatmentsBindingSource1) fields???
What is going on here? VS just started doing this...
Thanks,
Kris
-
Feb 27th, 2013, 08:05 PM
#2
Re: Data Binding stuffing up through Designer???
...
Also when i delete the \bin things start working ... but only until i run or build the project again.
Thanks,
Kris
-
Feb 28th, 2013, 06:53 PM
#3
Re: Data Binding stuffing up through Designer???
VS just started doing this...
Er ... no ... it didn't. It's doing what it's always done and what it should do, ie. creating a binding source for each control. This is so that you can have a single column from a table bound to two or more different controls (should you so desire) or individual values in a set of controls whilst simultaneously displaying the full table in DGV, for example.
Also why would you expect to be able to expand the fields for a binding source that, by definition, only has one field, as a textbox's source must?
These are simply the things that using design time bindings requires. If you find them inconvenient (and I don't blame you in the least if you do) learn to program for database interaction runtime. There are hundreds of tutorials about including a few very good ones in this forum's Codebank.
As the 6-dimensional mathematics professor said to the brain surgeon, "It ain't Rocket Science!"
Reviews: "dunfiddlin likes his DataTables" - jmcilhinney
Please be aware that whilst I will read private messages (one day!) I am unlikely to reply to anything that does not contain offers of cash, fame or marriage!
-
Feb 28th, 2013, 08:00 PM
#4
Re: Data Binding stuffing up through Designer???
Don't drag the columns from the Data Sources window one by one. As dunfiddlin says, the IDE will create a separate BindingSource for each one, exactly as it should. If you want one BindingSource for multiple columns in one table then you need to drag the table from the Data Sources window, not the columns. By default, a table will generate a DataGridView when dragged from the Data Sources window but you can change that to details view, i.e. discrete controls for each column. You can then delete the controls for the fields that you don't want to display.
Alternatively, if you already have a BindingSource then just don't drag anything from the Data Sources window. Simply add the appropriate control yourself and then bind it to the existing BindingSource via the Properties window.
-
Mar 3rd, 2013, 07:36 PM
#5
Re: Data Binding stuffing up through Designer???
As i said before ... "i cannot expand the bindingsource's (ResTreatmentsBindingSource1) fields"
Before delete obj folders:
And after i delete the obj folders:
Any ideas? ... this is just frustrating
Thanks,
Kris
-
Mar 3rd, 2013, 07:42 PM
#6
Re: Data Binding stuffing up through Designer???
Originally Posted by jmcilhinney
Don't drag the columns from the Data Sources window one by one. As dunfiddlin says, the IDE will create a separate BindingSource for each one, exactly as it should. If you want one BindingSource for multiple columns in one table then you need to drag the table from the Data Sources window, not the columns. By default, a table will generate a DataGridView when dragged from the Data Sources window but you can change that to details view, i.e. discrete controls for each column. You can then delete the controls for the fields that you don't want to display.
Alternatively, if you already have a BindingSource then just don't drag anything from the Data Sources window. Simply add the appropriate control yourself and then bind it to the existing BindingSource via the Properties window.
And actually both of you appear to be incorrect ... when i drag multiple fields from the same datasource it DOES NOT create multiple binding sources ... it just uses the one that is already on my form; it only creates multiple when i cannot view the fields in the binding source in the properties window (before i delete the obj folder)
Kris
-
Mar 3rd, 2013, 07:49 PM
#7
Re: Data Binding stuffing up through Designer???
And actually both of you appear to be incorrect ... when i drag multiple fields from the same datasource it DOES NOT create multiple binding sources
Well we would be, if either of us had actually said anything of the sort!
As the 6-dimensional mathematics professor said to the brain surgeon, "It ain't Rocket Science!"
Reviews: "dunfiddlin likes his DataTables" - jmcilhinney
Please be aware that whilst I will read private messages (one day!) I am unlikely to reply to anything that does not contain offers of cash, fame or marriage!
-
Mar 4th, 2013, 12:35 AM
#8
Re: Data Binding stuffing up through Designer???
Originally Posted by dunfiddlin
Well we would be, if either of us had actually said anything of the sort!
You said "It's doing what it's always done and what it should do, ie. creating a binding source for each control" ... this isn't the case though, if I drag multiple fields from the same datasource it does not behave this way and just creates just one binding source for that datasource and uses that for the multiple controls... and does not "create a binding source for each control"
Kris
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|