Databindings and Relationships

From: Oliver Lundt via .NET 247 (anonymous_at_dotnet247.com)
Date: 12/23/04

  • Next message: Arun: "Databinding composite objects"
    Date: Wed, 22 Dec 2004 16:04:45 -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>oIuEhoLsXEqhlgvZMFjLFA==</Id>


  • Next message: Arun: "Databinding composite objects"

    Relevant Pages

    • Databindings and Relationships
      ... lstHorses.ValueMember = "HorseId"; ... lstHorses.DisplayMember = "HorseName"; ... lblLocation is the databinding that is not working!! ...
      (microsoft.public.dotnet.framework.windowsforms.databinding)
    • Databindings and Relationships
      ... lstHorses.ValueMember = "HorseId"; ... lstHorses.DisplayMember = "HorseName"; ... lblLocation is the databinding that is not working!! ...
      (microsoft.public.dotnet.framework.windowsforms.databinding)
    • Databindings and Relationships
      ... lstHorses.ValueMember = "HorseId"; ... lstHorses.DisplayMember = "HorseName"; ... lblLocation is the databinding that is not working!! ...
      (microsoft.public.dotnet.framework.windowsforms.databinding)
    • Re: Databindings and Relationships
      ... >lblLocation is the databinding that is not working!! ... CurrencyManagers - Try changing the second to ... It relationship doesn't allow me to display ...
      (microsoft.public.dotnet.framework.windowsforms.databinding)

    Loading