in

C1 Community

ComponentOne Community is a free source for developers and help authors to collaborate and communicate.

Set combobox Text property to 2nd column

Last post 11-19-2007 2:01 PM by C1_GregL. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 11-19-2007 2:57 AM

    Set combobox Text property to 2nd column

    Hi,

     How can i set the text property of the C1combobox to the value of the second column when i have selected a row? This is my code:

    Dim c1 as new C1Datacolumn
    Dim c2 as new C2Datacolumn

    With Me.C1Combo
    .Columns.clear
    .Columns.Add(c1)
    .Columns.Add(c2)
    .Combostyle = CombostyleEnum.Dropdownlist
    .Datamode = DatamodeEnum.AddItem
    .bookmark = 2
    End with

    Me.C1Combo.clearitems
    Me.C1Combo.AddItem("Id 001" & ";" & "Texttoshow1")
    Me.C1Combo.AddItem("Id 002" & ";" & "Texttoshow2")
    Me.C1Combo.Splits(0).Displaycolumns(0).Visible = false

     Tia,

    Tim

     

  • 11-19-2007 2:01 PM In reply to

    • C1_GregL
    • Top 10 Contributor
    • Joined on 06-11-2007
    • Pittsburgh PA
    • Posts 500

    Re: Set combobox Text property to 2nd column

    Hi,

    You would set the DisplayMember property to whatever column you want to display

    C1Combo1.DisplayMember = C1Combo1.Columns(1).DataField

    Hope that helps,
    Greg L

    Filed under: ,
Page 1 of 1 (2 items)
Contact ComponentOne: 1.800.858.2739 ©1987-2008 ComponentOne LLC All Rights Reserved.