Results 1 to 2 of 2

Thread: ListView

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2002
    Location
    Pilipinas
    Posts
    441

    ListView

    1. I want to delete the item select my listview using this code but it doesn't work!

    ListView1.Items.RemoveAt(ListView1.SelectedIndexCollection)

    2. Using the code below I want to show in a messagebox the item of each listview.

    Dim a As Integer
    For a = 0 To ListView1.Items.Count - 1
    MessageBox.Show(ListView1.Items(a).Text & Chr(13) & ListView1.Items(a).SubItems(a).Text & Chr(13) & ListView1.Items(a).SubItems(a).Text)
    Next

    The message box should show like this,

    001
    John
    Accounting

    002
    Mark
    Commerce

    003
    Jason
    Law
    ========================

    Kindly help me solve these two problems in ListView?

    Attached w/ this thread is the file of this project.. thanks
    Attached Files Attached Files

  2. #2
    Frenzied Member dynamic_sysop's Avatar
    Join Date
    Jun 2003
    Location
    Ashby, Leicestershire.
    Posts
    1,142
    to list your items / subitems ....
    VB Code:
    1. Dim lvi As ListViewItem
    2.         Dim x As String = Environment.NewLine
    3.         For Each lvi In ListView1.Items
    4.             MessageBox.Show(lvi.Text & x & lvi.SubItems(0).Text & x & lvi.SubItems(1).Text)
    5.         Next
    to remove an item...
    VB Code:
    1. Dim lvi As ListViewItem = DirectCast(ListView1.Items(1), ListViewItem) '/// where (1) is the index of the item
    2.         ListView1.Items.Remove(lvi)
    ~
    if a post is resolved, please mark it as [Resolved]
    protected string get_Signature(){return Censored;}
    [vbcode][php] please use code tags when posting any code [/php][/vbcode]

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