Databindings and Relationships
From: Oliver Lundt via .NET 247 (anonymous_at_dotnet247.com)
Date: 10/31/04
- Next message: Giles: "Re: Exception in property in Windows Forms DataBinding"
- Previous message: Tim Bain via .NET 247: "Databinding to DataRow Properties"
- Messages sorted by: [ date ] [ thread ]
Date: Sun, 31 Oct 2004 03:56:17 -0800
I have a combobox bound to a table with a relationship. When the combobox selection changes the I change the values displayed. It works fine but only on the field in the same table. It relationship doesn't allow me to display values from the other table. Here my code:
//Add Relationships
DataRelation horseLocation = new DataRelation("HorseLocation",dsMain.Tables["tblLocation"].Columns["LocationId"],dsMain.Tables["tblHorseInfo"].Columns["LocationId"]);
dsMain.Relations.Add(horseLocation);
//fill combo box and values
lstHorses.DataSource = dsMain.Tables["tblHorseInfo"];
lstHorses.ValueMember = "HorseId";
lstHorses.DisplayMember = "HorseName";
lblOwner.DataBindings.Add("Text",dsMain.Tables["tblHorseInfo"].DefaultView,"OwnerName");
lblLocation.DataBindings.Add("Text",dsMain.Tables["tblHorseInfo"],"HorseLocation.tblHorseInfo.LocationName");
lblLocation is the databinding that is not working!!
I have the RelationshipName.TableName.TableField
Any ideas???
Thanks
--------------------------------
From: Oliver Lundt
-----------------------
Posted by a user from .NET 247 (http://www.dotnet247.com/)
<Id>2q4N+fmkpk2E7QtW2xWOSw==</Id>
- Next message: Giles: "Re: Exception in property in Windows Forms DataBinding"
- Previous message: Tim Bain via .NET 247: "Databinding to DataRow Properties"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|