Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Data Source for Binding Source Object
Message
 
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
Formulaires
Titre:
Data Source for Binding Source Object
Versions des environnements
Environment:
C# 2.0
Divers
Thread ID:
01446978
Message ID:
01446978
Vues:
78
Hi,

I am trying to understand the difference (and the right way) of setting up DataSource for a binding source object.

1. First I created a binding object "manually" dropping the Binding Source from the toolbar onto the form. And then I set the DataSource in code as following:
MyBindingSource.DataSource = dsMyDataSet.dtMyDataTable;
Everything was working as I was able to set up binding to textboxes and check box and a grid (as a whole).

Then I ran into an issue with trying to define columns of the grid individually and I did the following:

2. Created a Binding Source using the VS 2005 wizard where it allow you to navigate to the Data Set and Data Table of the project there such data set resides.

In the Designer section of the form class I found that this way the binding source is defined a little differently, as following:
MyWizardBindingSource.DataSource = typeof(  MyDataSetProject.dsMyDataSetNameInTheProject.dtMyTableTableDataTable);
Now the grid is bound to both MyBindingSource and MyWizard binding source. I want to eliminate one as I think it is not right that I have 2 binding source objects (I think).

So my question is, should I have set the MyBindingSource.DataSource to the typeof() - as wizard did -instead of setting it to the data table? Or the wizard is not correct but only works for grids?

I would appreciate any input on this.
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Répondre
Fil
Voir

Click here to load this message in the networking platform