ListBox - Mover


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 8 of 8

Thread: ListBox - Mover

  1. #1
    rkbnair Guest

    ListBox - Mover


    Is there any listbox type controls using which I can change the order of the
    items and also select an item (by check marking)?

    I know the standard listbox has a select method but NO order change method.

    Thanks in advance,

    RK.



  2. #2
    ArthurWood Guest

    Re: ListBox - Mover


    rkbnair,
    What are you using? in VB 6.0, the ListBox control has a Sorted Property.
    You can set it at design time, or at runtime.

    How are you populating the ListBox, is it a bound control, or are you using
    code?

    If bound, is it bound to a table, or a query?

    If a Query, can't you change the sort order of the query? If a Table, then
    create a query to retrieve the values from the table, and set the sort order
    in the query.


    Also, with the standard listbox control, change the style to CheckBox, and
    you will get a checkbox for each line to indicate that it was selected.

    Arthur Wood
    "rkbnair" <rkannale@solus1.oceaneering.com> wrote:
    >
    >Is there any listbox type controls using which I can change the order of

    the
    >items and also select an item (by check marking)?
    >
    >I know the standard listbox has a select method but NO order change method.
    >
    >Thanks in advance,
    >
    >RK.
    >
    >



  3. #3
    rkbnair Guest

    Re: ListBox - Mover


    Arthur,
    I'm sorry, I didn't explain it correctly. I want the end user be able to
    change the order of the items in the list box. May be by clicking and dragging
    items or so.

    Sorry for that, and thank you.

    RK.


    "ArthurWood" <wooda@saic-trsc.com> wrote:
    >
    >rkbnair,
    > What are you using? in VB 6.0, the ListBox control has a Sorted Property.
    > You can set it at design time, or at runtime.
    >
    >How are you populating the ListBox, is it a bound control, or are you using
    >code?
    >
    >If bound, is it bound to a table, or a query?
    >
    >If a Query, can't you change the sort order of the query? If a Table, then
    >create a query to retrieve the values from the table, and set the sort order
    >in the query.
    >
    >
    >Also, with the standard listbox control, change the style to CheckBox, and
    >you will get a checkbox for each line to indicate that it was selected.
    >
    >Arthur Wood
    >"rkbnair" <rkannale@solus1.oceaneering.com> wrote:
    >>
    >>Is there any listbox type controls using which I can change the order of

    >the
    >>items and also select an item (by check marking)?
    >>
    >>I know the standard listbox has a select method but NO order change method.
    >>
    >>Thanks in advance,
    >>
    >>RK.
    >>
    >>

    >



  4. #4
    rkbnair Guest

    Re: ListBox - Mover


    Arther, it is again me.

    Yes I'm using vb 6.0

    Thanks

    "ArthurWood" <wooda@saic-trsc.com> wrote:
    >
    >rkbnair,
    > What are you using? in VB 6.0, the ListBox control has a Sorted Property.
    > You can set it at design time, or at runtime.
    >
    >How are you populating the ListBox, is it a bound control, or are you using
    >code?
    >
    >If bound, is it bound to a table, or a query?
    >
    >If a Query, can't you change the sort order of the query? If a Table, then
    >create a query to retrieve the values from the table, and set the sort order
    >in the query.
    >
    >
    >Also, with the standard listbox control, change the style to CheckBox, and
    >you will get a checkbox for each line to indicate that it was selected.
    >
    >Arthur Wood
    >"rkbnair" <rkannale@solus1.oceaneering.com> wrote:
    >>
    >>Is there any listbox type controls using which I can change the order of

    >the
    >>items and also select an item (by check marking)?
    >>
    >>I know the standard listbox has a select method but NO order change method.
    >>
    >>Thanks in advance,
    >>
    >>RK.
    >>
    >>

    >



  5. #5
    George Handlin Guest

    Re: ListBox - Mover

    Check out the controls over at ccrp. One of the guys there wrote one.. I
    forget who it was now, I think Karl. Anyway, http://www.mvps.org/ccrp

    There are a lot of great controls there.


    "rkbnair" <rkannale@solus1.oceaneering.com> wrote in message
    news:3a42227c$1@news.devx.com...
    >
    > Is there any listbox type controls using which I can change the order of

    the
    > items and also select an item (by check marking)?
    >
    > I know the standard listbox has a select method but NO order change

    method.
    >
    > Thanks in advance,
    >
    > RK.
    >
    >




  6. #6
    Arthur Wood Guest

    Re: ListBox - Mover


    You could always add a button (Labelled "Sort") and then in its click event,

    Private Sub cmdSort_Click()
    ' this will toggle the Sorted Property
    ListBox1.Sorted = Not ListBox1.Sorted
    end Sub

    will this accomplish what you need. Otherwise check out ccrp as another
    poster suggested.

    Arthur Wood


    "rkbnair" <rkannale@solus1.oceaneering.com> wrote:
    >
    >Arther, it is again me.
    >
    >Yes I'm using vb 6.0
    >
    >Thanks
    >
    >"ArthurWood" <wooda@saic-trsc.com> wrote:
    >>
    >>rkbnair,
    >> What are you using? in VB 6.0, the ListBox control has a Sorted Property.
    >> You can set it at design time, or at runtime.
    >>
    >>How are you populating the ListBox, is it a bound control, or are you using
    >>code?
    >>
    >>If bound, is it bound to a table, or a query?
    >>
    >>If a Query, can't you change the sort order of the query? If a Table,

    then
    >>create a query to retrieve the values from the table, and set the sort

    order
    >>in the query.
    >>
    >>
    >>Also, with the standard listbox control, change the style to CheckBox,

    and
    >>you will get a checkbox for each line to indicate that it was selected.
    >>
    >>Arthur Wood
    >>"rkbnair" <rkannale@solus1.oceaneering.com> wrote:
    >>>
    >>>Is there any listbox type controls using which I can change the order

    of
    >>the
    >>>items and also select an item (by check marking)?
    >>>
    >>>I know the standard listbox has a select method but NO order change method.
    >>>
    >>>Thanks in advance,
    >>>
    >>>RK.
    >>>
    >>>

    >>

    >



  7. #7
    Rick Rothstein Guest

    Re: ListBox - Mover

    Put a ListBox in a new project (leave its Name as the default of List1).
    Paste this code into the Form's code window and Run the project.

    ********START PASTE********
    Dim DragIndex As Long

    Private Sub Form_Load()
    With List1
    For X = 0 To 30
    .AddItem "Item #" & CStr(X + 1)
    Next
    End With
    End Sub

    Private Sub List1_MouseDown(Button As Integer, _
    Shift As Integer, X As Single, Y As Single)
    With List1
    DragIndex = .ListIndex
    End With
    End Sub

    Private Sub List1_MouseUp(Button As Integer, _
    Shift As Integer, X As Single, Y As Single)
    With List1
    If DragIndex <> .ListIndex Then
    ListText = .List(DragIndex)
    .RemoveItem DragIndex
    .AddItem ListText, .ListIndex
    .ListIndex = .NewIndex
    End If
    End With
    End Sub
    ********END PASTE********

    Now click on an item and move your cursor to a new spot in the list. When
    you release the mouse button, the item will be moved to the location of the
    mouse indicator. Was that the functionality you were after?

    Rick



    "rkbnair" <rkannale@solus1.oceaneering.com> wrote in message
    news:3a423a01$1@news.devx.com...
    >
    > Arthur,
    > I'm sorry, I didn't explain it correctly. I want the end user be able to
    > change the order of the items in the list box. May be by clicking and

    dragging
    > items or so.
    >
    > Sorry for that, and thank you.
    >
    > RK.
    >
    >
    > "ArthurWood" <wooda@saic-trsc.com> wrote:
    > >
    > >rkbnair,
    > > What are you using? in VB 6.0, the ListBox control has a Sorted

    Property.
    > > You can set it at design time, or at runtime.
    > >
    > >How are you populating the ListBox, is it a bound control, or are you

    using
    > >code?
    > >
    > >If bound, is it bound to a table, or a query?
    > >
    > >If a Query, can't you change the sort order of the query? If a Table,

    then
    > >create a query to retrieve the values from the table, and set the sort

    order
    > >in the query.
    > >
    > >
    > >Also, with the standard listbox control, change the style to CheckBox,

    and
    > >you will get a checkbox for each line to indicate that it was selected.
    > >
    > >Arthur Wood
    > >"rkbnair" <rkannale@solus1.oceaneering.com> wrote:
    > >>
    > >>Is there any listbox type controls using which I can change the order of

    > >the
    > >>items and also select an item (by check marking)?
    > >>
    > >>I know the standard listbox has a select method but NO order change

    method.
    > >>
    > >>Thanks in advance,
    > >>
    > >>RK.
    > >>
    > >>

    > >

    >




  8. #8
    Karl E. Peterson Guest

    Re: ListBox - Mover

    Appreciate the recommend, George, but the DragList style is incompatable with
    Checkboxes. Wish it weren't so, but it is.
    --
    http://www.mvps.org/vb

    "George Handlin" <handling@nospam.home.com> wrote in message
    news:3a424739@news.devx.com...
    > Check out the controls over at ccrp. One of the guys there wrote one.. I
    > forget who it was now, I think Karl. Anyway, http://www.mvps.org/ccrp
    >
    > There are a lot of great controls there.
    >
    >
    > "rkbnair" <rkannale@solus1.oceaneering.com> wrote in message
    > news:3a42227c$1@news.devx.com...
    > >
    > > Is there any listbox type controls using which I can change the order of

    > the
    > > items and also select an item (by check marking)?
    > >
    > > I know the standard listbox has a select method but NO order change

    > method.
    > >
    > > Thanks in advance,
    > >
    > > RK.
    > >
    > >

    >
    >



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