Retrieving items from a bound list control


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 7 of 7

Thread: Retrieving items from a bound list control

  1. #1
    T OPry Guest

    Retrieving items from a bound list control

    I know I'm missing something incredible simple, but it's Friday and I've
    been beating on this for hours...

    Listbox bound to a Dataset
    How do you retrieve an item(s) from the list?

    Since it is bound, the usual methods do not work (List1.SelectedItem, etc).
    I'm assuming that being bound only a list of pointers is in the control, so
    I would reference the Dataset, but which object and if I filter the dataset
    using .DefaultView.RowFilter, does that effect the methodology used?



  2. #2
    Kathleen Dollard Guest

    Re: Retrieving items from a bound list control

    > Listbox bound to a Dataset
    > How do you retrieve an item(s) from the list?


    Did you get this figured out? One way is to go through the position of the
    currency manager (bindingmanagerbase) property of the binding and look at
    the table. SelectedValue and SelectedItem should work though (SelectedItem
    should return a DataRow object which you would then query).

    Kathleen



  3. #3
    T OPry Guest

    Re: Retrieving items from a bound list control

    Kathleen -
    Thank you for the reply, I was out of town since I posted this. While I have
    a solution, I'm not sure it is the most elegant.
    The bound Listbox.SelectedItem returns a DataRowView object and from that
    the .Item() property provides the string data. No problem with this, but the
    functionality of what I am trying to accomplish.

    The goal is a diminishing return list, where the user types in the first
    character of customer code (name) and a result set LIKE 'a%' is returned
    within a DataView object. With each successive keystroke, I return the
    matching subset using the .RowFilter property, which works fine - except for
    the UI component.

    I originally tried a bound combo, but its default behavior is to select all
    of the text within the edit portion of the control and attempts to override
    that behavior were unsuccessful.

    Currently, I mimic the dropdown behavior via an edit control and a listbox.
    While functional, I cannot help but feel that there is a more elegant and
    straightforward solution. I would think that this functionality is rather
    common as I have seen the implementation in several CRM type applications.

    If anyone has any suggestions, I would appreciate the input.




    "Kathleen Dollard" <kathleen@mvps.org> wrote in message
    news:3cb1fcc2$1@10.1.10.29...
    > > Listbox bound to a Dataset
    > > How do you retrieve an item(s) from the list?

    >
    > Did you get this figured out? One way is to go through the position of the
    > currency manager (bindingmanagerbase) property of the binding and look at
    > the table. SelectedValue and SelectedItem should work though (SelectedItem
    > should return a DataRow object which you would then query).
    >
    > Kathleen
    >
    >




  4. #4
    Kathleen Dollard Guest

    Re: Retrieving items from a bound list control

    > I originally tried a bound combo, but its default behavior is to select
    all
    > of the text within the edit portion of the control and attempts to

    override
    > that behavior were unsuccessful.


    Really? With DropDownCombo style, _not DropDownList style? Try that, and
    then your validation, in either the controls Validating event (blech) or the
    DataTable's ColumnChanging event (cool) will have to insure the user's
    selection is in the list.

    Kathleen




  5. #5
    T OPry Guest

    Re: Retrieving items from a bound list control

    I did attempt with the style set to DrowDownList - the simplest description
    of functionality is similar to the URL (address) combo within IE. As the
    user starts typing in the edit portion of the control (setting the RowFilter
    in the KeyPress event), the dropdown displays the filtered subset of the
    query and the first item in the list is forced into the Edit portion of the
    control, fully highlighted.

    Additionally, when I set the .DropppedDown property to True, the cursorstate
    is 'confused' (not visible over the parent form).

    If you have any suggestions on how to make this work, I would be interested
    and grateful.



    "Kathleen Dollard" <kathleen@mvps.org> wrote in message
    news:3cb5abfb$1@10.1.10.29...
    > > I originally tried a bound combo, but its default behavior is to select

    > all
    > > of the text within the edit portion of the control and attempts to

    > override
    > > that behavior were unsuccessful.

    >
    > Really? With DropDownCombo style, _not DropDownList style? Try that, and
    > then your validation, in either the controls Validating event (blech) or

    the
    > DataTable's ColumnChanging event (cool) will have to insure the user's
    > selection is in the list.
    >
    > Kathleen
    >
    >
    >




  6. #6
    Kathleen Dollard Guest

    Re: Retrieving items from a bound list control

    > I did attempt with the style set to DrowDownList

    OK, but did you try DropDownComb style?

    > > Really? With DropDownCombo style, _not DropDownList style? Try that, "T

    OPry"

    Kathleen




  7. #7
    T OPry Guest

    Re: Retrieving items from a bound list control

    Yes, that was I typo on my part on the last message. I tried the combo style
    as well. The default behavior is fill in the edit portion with the top item
    in the list and select.


    "Kathleen Dollard" <kathleen@mvps.org> wrote in message
    news:3cb98154@10.1.10.29...
    > > I did attempt with the style set to DrowDownList

    >
    > OK, but did you try DropDownComb style?
    >
    > > > Really? With DropDownCombo style, _not DropDownList style? Try that,

    "T
    > OPry"
    >
    > Kathleen
    >
    >
    >




Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center