![]() | |
![]() |
| | Thread Tools | Search this Thread | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Hi! I have som problems using drag n drop functionallity in visualstudio 2005. I have created a dataset from my sqlexpress with one main table and three valuetables using IDnumbers to get the realname of each child.. I then created a datagridview and changed the IDvalues ( FKs ) to databinded comboboxes to display the correct values. So far so good all values are displayed correctly! When I try to drag n drop the detail ( as comboboxes ) these are to be used to select values to change/add the data in the datagrid. the bindings are set as follows: Datasource: NameBindingSource Displaymember: Name Value Member: NameID Selected Value: MainBindingSource - NameID This works as long as I only use ONE combobox, if I add anotherone from another table as follows: Datasource: LastNameBindingSource DisplayName: LastName Value Member: LastNameID Selected Value: MainBindingSource - LastNameID The result will be that when I select a LastName I cant leave that combobx. No other event will respond, the only solution is to kill the application. Today I noticed that if I manually add numeric values to in my database it will work for the numeric values only. Is this a known bug or is it me using bindings the wrong way? I have a ready example to upload if theres anyone interested in this problem. -- kind regards Erik Developer |
#3
| |||
| |||
|
|
Hi Erik, Without knowing the details it looks like you encounter some kind of eternal loop, although I could not reproduce your problem using a BindingList as source for two BindingSources. Selecting a person from the second comboBox would update NameID of the selected person from the first ComboBox My setup code was as follows. Person is a business object having a string Name and int Id property Person personA = new Person("Pete", 1); Person personB = new Person("James", 2); Person personC = new Person("Richard", 3); _personList.Add(personA); _personList.Add(personB); _personList.Add(personC); dataGridView1.DataSource = _personList; sourceMain = new BindingSource(_personList, ""); sourceLast = new BindingSource(_personList, ""); comboBox1.DataSource = sourceMain; comboBox1.DisplayMember = "Name"; comboBox1.ValueMember = "Id"; comboBox2.DataSource = sourceLast; comboBox2.DisplayMember = "Name"; comboBox2.ValueMember = "Id"; comboBox2.DataBindings.Add("SelectedValue", sourceMain, "Id"); -- Happy Coding! Morten Wennevik [C# MVP] "erah" wrote: Hi! I have som problems using drag n drop functionallity in visualstudio 2005. I have created a dataset from my sqlexpress with one main table and three valuetables using IDnumbers to get the realname of each child.. I then created a datagridview and changed the IDvalues ( FKs ) to databinded comboboxes to display the correct values. So far so good all values are displayed correctly! When I try to drag n drop the detail ( as comboboxes ) these are to be used to select values to change/add the data in the datagrid. the bindings are set as follows: Datasource: NameBindingSource Displaymember: Name Value Member: NameID Selected Value: MainBindingSource - NameID This works as long as I only use ONE combobox, if I add anotherone from another table as follows: Datasource: LastNameBindingSource DisplayName: LastName Value Member: LastNameID Selected Value: MainBindingSource - LastNameID The result will be that when I select a LastName I cant leave that combobx. No other event will respond, the only solution is to kill the application. Today I noticed that if I manually add numeric values to in my database it will work for the numeric values only. Is this a known bug or is it me using bindings the wrong way? I have a ready example to upload if theres anyone interested in this problem. -- kind regards Erik Developer |
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
| |