Click here to Skip to main content
15,913,090 members
Home / Discussions / C#
   

C#

 
GeneralPivot table in .net Pin
Prabhakar.A15-Mar-05 3:20
Prabhakar.A15-Mar-05 3:20 
GeneralRe: Pivot table in .net Pin
Ravindra Sadaphule15-Mar-05 5:33
Ravindra Sadaphule15-Mar-05 5:33 
GeneralRe: Pivot table in .net Pin
Prabhakar.A15-Mar-05 19:50
Prabhakar.A15-Mar-05 19:50 
GeneralReflex between objects! Help! Pin
oohungoo15-Mar-05 3:15
oohungoo15-Mar-05 3:15 
GeneralRe: Reflex between objects! Help! Pin
mav.northwind15-Mar-05 4:32
mav.northwind15-Mar-05 4:32 
GeneralTake this as challenging task for smart device application Pin
sivaji raju15-Mar-05 2:31
sivaji raju15-Mar-05 2:31 
GeneralComboBox Pin
Bahadir Cambel15-Mar-05 2:29
Bahadir Cambel15-Mar-05 2:29 
GeneralRe: ComboBox Pin
Ravindra Sadaphule15-Mar-05 7:02
Ravindra Sadaphule15-Mar-05 7:02 
Thats a great question!.

The dafault behaviour is windows forms creates at least one currency manager object for each data sources included in the form. The currency manager is managed through BindingContext object.
This behaviour is intentionally incorporated in order to keep all the controls on the form synchronized with data source.

For Instance if you have two combo boxes FirstName and LastName bound to dsCustomer, then if user changes FirstName, the lastname column also changes in order to reflect the correct customer. Windows forms moves binding context beind the scenes and programmer is relived of writing code to synchronize the controls.

If you do not want this feature, then you need to make a copy of the datasource and then bind it to combo boxes as illustrated in the code below.


private void Form1_Load(object sender, System.EventArgs e)
{
System.Data.SqlClient.SqlDataAdapter da = new System.Data.SqlClient.SqlDataAdapter("Select top 10 * from authors", "Data Source=ITD2142s;Initial Catalog=pubs;Integrated Security=SSPI;");
ds = new System.Data.DataSet();
da.Fill(ds);
comboBox1.DataSource = ds.Copy().Tables[0] ;
comboBox1.DisplayMember = "au_lname";
comboBox2.DataSource = ds.Copy().Tables[0] ;;
comboBox2.DisplayMember = "au_fname";


}


Hope this helps Wink | ;) .


Cheers
Ravindra Sadaphule
MCSD.NET
GeneralRe: ComboBox Pin
Bahadir Cambel15-Mar-05 7:31
Bahadir Cambel15-Mar-05 7:31 
GeneralRe: ComboBox Pin
Ravindra Sadaphule15-Mar-05 7:37
Ravindra Sadaphule15-Mar-05 7:37 
GeneralRe: ComboBox Pin
Bahadir Cambel15-Mar-05 7:43
Bahadir Cambel15-Mar-05 7:43 
Generaldisplay custom column names in datagrid Pin
itssuk15-Mar-05 2:11
itssuk15-Mar-05 2:11 
GeneralRe: display custom column names in datagrid Pin
Ravindra Sadaphule15-Mar-05 7:12
Ravindra Sadaphule15-Mar-05 7:12 
GeneralWinforms IDE problem Pin
Fragging15-Mar-05 1:37
Fragging15-Mar-05 1:37 
GeneralRe: Winforms IDE problem Pin
Robert Rohde15-Mar-05 6:36
Robert Rohde15-Mar-05 6:36 
GeneralRe: Winforms IDE problem Pin
Ravindra Sadaphule15-Mar-05 7:15
Ravindra Sadaphule15-Mar-05 7:15 
GeneralRe: Winforms IDE problem Pin
Fragging15-Mar-05 7:47
Fragging15-Mar-05 7:47 
QuestionHow to identify user, who runs a certain process? Pin
3Dizard15-Mar-05 1:28
3Dizard15-Mar-05 1:28 
AnswerRe: How to identify user, who runs a certain process? Pin
Scott Serl15-Mar-05 10:34
Scott Serl15-Mar-05 10:34 
GeneralMobile Application cannot call web service it added as web reference. Pin
Rene Xavier15-Mar-05 1:17
Rene Xavier15-Mar-05 1:17 
GeneralRe: Mobile Application cannot call web service it added as web reference. Pin
Kodanda Pani15-Mar-05 2:36
Kodanda Pani15-Mar-05 2:36 
GeneralRe: Mobile Application cannot call web service it added as web reference. Pin
Rene Xavier15-Mar-05 5:35
Rene Xavier15-Mar-05 5:35 
GeneralRe: Mobile Application cannot call web service it added as web reference. Pin
Kodanda Pani15-Mar-05 17:10
Kodanda Pani15-Mar-05 17:10 
GeneralRe: Mobile Application cannot call web service it added as web reference. Pin
Rene Xavier15-Mar-05 19:17
Rene Xavier15-Mar-05 19:17 
GeneralDisplaying thumbnails Pin
scotlandc15-Mar-05 0:35
scotlandc15-Mar-05 0:35 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.