Results 1 to 7 of 7

Thread: more on listview... help with data input please

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Mar 2000
    Posts
    168
    hello, I finally got the listview to look the way i though it was supposed to thanks to the help on here. but now im having one hell of a time trying to figure out how to input data to it.. i set up two columns. a listitem is a ROW in the listview right? because when i did listview.listitems.add, it inserted a new line. now.. how do I insert data into row1, column1, and row1, column2? etc etc.. and does this work like the listbox where you have a listindex to tell you what item it is on? please help or show some examples if you can, thanks!

    Thai

  2. #2
    Lively Member
    Join Date
    Jan 1999
    Location
    Rochester NY, USA
    Posts
    93
    Here's some help on the listbox


    lisbox.additem will add an item to the list.
    listbox.listindex will be the ordinal number of the currently selected item.
    listbox.clear will remove everything from the list.
    listbox.list(number) is used to either get the text at that location or to set the text at that location. ex..

    mystring = listbox.list(1) .. to get ..
    listbox.list(1) = mystring .. to set ..

    listbox.removeitem(number) will remove that item.

    Your best bet is to look at all the methods, etc that are part of a listbox... that's how you're going to learn the most about controls.. Get real friendly with the F1 key



  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Mar 2000
    Posts
    168

    uhm, not quite

    was looking for examples on LISTVIEW, not listbox.. thanks though

    --

    anyway, I figured out how to add data, now.. im trying to figure out how to make it do something when one of the items is double clicked.. can someowne show me how to make it say the text of the column when the item if double clicked?

    thanks for all the help,
    Thai

  4. #4
    Addicted Member
    Join Date
    Jan 2000
    Location
    Fresno, California, USA
    Posts
    195
    You are correct. Listitems are like rows. The first column is the listitem itself. For columns after the first, you need to reference subitems.

    Set itmX = frmForm.lstList.ListItems.Add(, key, column1Value)
    itmX.SubItems(1) = "column2Value"

    and so on.

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Mar 2000
    Posts
    168

    cool..

    thank you.. do you know how to find out what the current selected item is? like the listindex property of the listbox. i want a messagebox to display the listitem whenever it is double clicked. how would I do that? thanks again!

    Thai

  6. #6

    Thread Starter
    Addicted Member
    Join Date
    Mar 2000
    Posts
    168

    nevermind got it

    amazingly, if you look hard enough.. theres a property called SELECTEDITEM.. im on crack today.. hehe thanks anyway everyone =)

    Thai

  7. #7
    Addicted Member
    Join Date
    Jan 2000
    Location
    Fresno, California, USA
    Posts
    195
    There are two ways. You can loop through the collection of listitems and check the selected property:

    for X = 1 to ubound(lstListView.ListItems)
    if lstListView.ListItem(X).Selected = True then
    ' You know which was selected
    end if
    next

    Or, you can use selecteditem:

    X = lstListView.SelectedItem.Index

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width