Combining to columns to show them in a Combobox

Posts   
 
    
eirizarry
User
Posts: 48
Joined: 30-Mar-2011
# Posted on: 29-Aug-2012 00:35:17   

How i can combine to columns from the Oracle database to show them in the combobox. Im using a ComboBox attached to a LLBLGenProDataSource to show the records on the ComboBox. I try the following code:

  Public Function LongDescription() As String
        Try
            Return "(" & Me.BusinessUnitOrder & ") " & Me.Description & ""
        Catch ex As Exception
            Return ""
        End Try
    End Function 

But it works fine in the EntityClasses but not in the ColletionClasses. Any Help?

thanks,

Elvin

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 29-Aug-2012 06:30:58   

Hi Elvin,

It should work only by putting the custom property into your EntityClass partial class. Example of the code inside the entity:

Namespace [YourRootNamespace].EntityClasses
    Public Partial Class CustomerEntity
        Public ReadOnly Property FullName() As String
            Get
                Return String.Format("{0} - {1}", Me.ContactTitle, Me.ContactName)
            End Get
        End Property
    End Class
End Namespace

Note that it's a Property, not a Function. Then in your WinForm application:

Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
        ' Fetch customers, which is a CustomerCollection, or an EntityCollection(Of CustomerEntity) for adapter.
        ' ...

        _cbxCustomers.DataSource = customers
        _cbxCustomers.DisplayMember = "FullName"
        _cbxCustomers.ValueMember = "CustomerId"

        _cbxCustomers.Refresh()

    End Sub

It should work without problems.

David Elizondo | LLBLGen Support Team
eirizarry
User
Posts: 48
Joined: 30-Mar-2011
# Posted on: 29-Aug-2012 15:04:21   

works fine!!!.

thanks