in

C1 Community

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

Selected Item in Listbox

Last post 02-11-2008 4:08 PM by gessi52. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 02-06-2008 4:27 AM

    Selected Item in Listbox

    Hello

     I've a simple task. There is a c1ListBox with 100 rows. Each row has 5 columns.

    1. When the user selects the 18th row. I need the values of all columns of this row.

    2. If multiselection is allowed, how do I retrieve the information of the selected rows?

    Thanks for your help

     

    beste regards

    GESSI 

     

  • 02-06-2008 3:20 PM In reply to

    Re: Selected Item in Listbox

    Hello GESSI,
     
    To retrieve the values of a column in the current row, you may use the following code.
     
        Me.C1List1.Columns(0).Value ' this retrieves the value of the 0th column in the current row.
     
    Similary, you can retrieve the same for all the columns, changing the column index.
     
    If multiselection is concerned, you may use the following code to loop through the selected Rows
    to retrieve the value.

    Dim i As Integer

    Dim value As Integer

    For i = 0 To Me.C1List1.SelectedIndices.Count - 1

    value = Me.C1List1.SelectedIndices.Item(i)

    MsgBox(Me.C1List1.Columns(0).CellText(value))

    Next

    SelectedIndices return the SelectedRows collection object. Please go through attached
    sample application for exact implementation.
     
    I hope this will help.

    Regards,
     
    Allen Smith
    <gessi52> wrote in message news:201677@10.0.1.98...

    Hello

     I've a simple task. There is a c1ListBox with 100 rows. Each row has 5 columns.

    1. When the user selects the 18th row. I need the values of all columns of this row.

    2. If multiselection is allowed, how do I retrieve the information of the selected rows?

    Thanks for your help

     

    beste regards

    GESSI 

     



    http://helpcentral.componentone.com/cs/forums/p/74220/201677.aspx#201677

  • 02-11-2008 4:08 PM In reply to

    Re: Selected Item in Listbox

    Hi Allen

     That's exactly what I want to know. Many thanks for your rapidly replay.

     best regards

    GESSI

Page 1 of 1 (3 items)
Contact ComponentOne: 1.800.858.2739 ©1987-2008 ComponentOne LLC All Rights Reserved.