I have tried using 1.5.3 and
EntitySpaces Version # 2007.0.0304.0
MyGeneration Version # 1.2.0.2
Code:
Private collJudgments As JrMoneyJudgmentsCollection = New JrMoneyJudgmentsCollection
Private collCounties As CountiesCollection = New CountiesCollection
Private Sub frmJudgments_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Try
collJudgments.LoadAll()
With collCounties.Query
.Select(.Id, .CountyName)
.OrderBy(.CountyName.Ascending)
.Load()
End With
Me.JrMoneyJudgmentsCollectionBindingSource.DataSource = collJudgments
Me.CountiesCollectionBindingSource.DataSource = collCounties
Now fill the combo:
Code:
With Me.C1Combo1
.DataSource = Nothing
.DataSource = collCounties
.DisplayMember = CountiesMetadata.ColumnNames.CountyName
.ValueMember = CountiesMetadata.ColumnNames.Id
.DataBindings.Add(New System.Windows.Forms.Binding("selectedvalue", Me.JrMoneyJudgmentsCollectionBindingSource, jrmoneyjudgmentsmetadata.ColumnNames.CountyID , True))
End With
Code:
With Me.CountyNameComboBox
.DataSource = Nothing
.DataSource = collCounties
.DisplayMember = CountiesMetadata.ColumnNames.CountyName
.ValueMember = CountiesMetadata.ColumnNames.Id
.DataBindings.Add(New System.Windows.Forms.Binding("SelectedValue", JrMoneyJudgmentsCollectionBindingSource, jrmoneyjudgmentsmetadata.ColumnNames.CountyID, True))
End With
The standard combobox will display the correct text in the text box portion of the combo. The ComponentOne combo does not.
Now if I use NorthWind
Code:
Private collOrders As BusinessObjects.OrdersCollection = New BusinessObjects.OrdersCollection
Private collCustomers As BusinessObjects.CustomersCollection = New BusinessObjects.CustomersCollection
collOrders.LoadAll()
With collCustomers.Query
.Select(.CustomerID,.CompanyName )
.OrderBy(.ContactName .Ascending)
.Load()
End With
Me.bsOrders.DataSource = collOrders
Me.bsCustomersCollection.DataSource = collCustomers
Code:
With Me.CompanyNameComboBox
.DataSource = Nothing
.DataSource = collCustomers
.DisplayMember = CustomersMetadata.ColumnNames.CompanyName
.ValueMember = CustomersMetadata.ColumnNames.CustomerID
.DataBindings.Add(New System.Windows.Forms.Binding("SelectedValue", bsOrders, OrdersMetadata.ColumnNames.CustomerID, True))
End WithCode:
With Me.C1Combo1
.DataSource = Nothing
.DataSource = collCustomers
.DisplayMember = CustomersMetadata.ColumnNames.CompanyName
.ValueMember = CustomersMetadata.ColumnNames.CustomerID
.DataBindings.Add(New System.Windows.Forms.Binding("SelectedValue", bsOrders, OrdersMetadata.ColumnNames.CustomerID, True))
End With
All works as expected for both the standard combo and ComponentOne Combo. This suggests the problem is not ComponentOne Combo and leads me to think there is something in the tables causing difficulty.
This is my county table:
Code:
/****** Object: Table [dbo].[counties] Script Date: 03/06/2007 21:10:34 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[counties](
[ID] [int] IDENTITY(1,1) NOT NULL,
[CountyName] [nvarchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[CountyCode] [nvarchar](2) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[SelectionTypeID] [int] NULL,
[aka] [nvarchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[TimeStamp] [timestamp] NULL,
CONSTRAINT [PK_counties] PRIMARY KEY CLUSTERED
(
[ID] ASC
)WITH (PAD_INDEX = OFF, IGNORE_DUP_KEY = OFF, FILLFACTOR = 90) ON [PRIMARY]
) ON [PRIMARY]
and the parent table:
Code:
/****** Object: Table [dbo].[jrMoneyJudgments] Script Date: 03/06/2007 21:19:08 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[jrMoneyJudgments](
[ID] [int] IDENTITY(1,1) NOT NULL,
[RecordType] [int] NULL,
[CountyID] [int] NULL,
[CourtID] [int] NULL,
[FirstName] [nvarchar](100) COLLATE Latin1_General_CI_AI NULL,
[Surname] [nvarchar](100) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
...
[timestamp] [timestamp] NOT NULL,
CONSTRAINT [PK_jrMoneyJudgments] PRIMARY KEY CLUSTERED
(
[ID] ASC
)WITH (PAD_INDEX = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
ALTER TABLE [dbo].[jrMoneyJudgments] WITH CHECK ADD CONSTRAINT [FK_MoneyJudgements_Courts] FOREIGN KEY([CourtID])
REFERENCES [dbo].[jrCourts] ([courtID])
GO
ALTER TABLE [dbo].[jrMoneyJudgments] CHECK CONSTRAINT [FK_MoneyJudgements_Courts]
Initially I had a link between these on CountyId > id but removed it in testing.
What am I missing? All suggestions welcome.
Declan