8 Replies - 8808 Views - Last Post: 05 December 2011 - 02:47 PM Rate Topic: -----

#1 deery5000  Icon User is offline

  • D.I.C Addict

Reputation: 78
  • View blog
  • Posts: 977
  • Joined: 09-May 09

edit listview item?

Posted 04 December 2011 - 07:33 AM

Hi guys,

Im trying to edit an item in a listview. I can edit the item ok but i want to execute code to rename the directory after the edit. The code executes before the edit is completed ?

Is there a way to wait until the name has been change first?

heres my code
Private Sub ListView1_DoubleClick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListView1.DoubleClick

        'sub to update directory name if user chooses to edit movie title 
        Try
            'allow editing on listview
            ListView1.SelectedItems(0).BeginEdit()
        Catch ex As Exception

        End Try


        'get index value of selected item
        Dim index = ListView1.Items.Item(ListView1.SelectedIndices(0)).Index

        'get the old file path
        Dim oldPath = directorylist(index)

        'create new path / working on this
        'Dim newPath As String() = oldPath.ToString.Split("\")

        'rename the directory with the newly edited label
        'FileIO.FileSystem.RenameDirectory(oldPath, newPath)

    End Sub


This post has been edited by deery5000: 04 December 2011 - 07:39 AM


Is This A Good Question/Topic? 0
  • +

Replies To: edit listview item?

#2 Ionut  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 385
  • View blog
  • Posts: 1,057
  • Joined: 17-July 10

Re: edit listview item?

Posted 04 December 2011 - 09:22 AM

You can try using one of the following events:
Leave
Enter
LostFocus

See if any of these are working for you. First, you should test with Enter event
Was This Post Helpful? 0
  • +
  • -

#3 deery5000  Icon User is offline

  • D.I.C Addict

Reputation: 78
  • View blog
  • Posts: 977
  • Joined: 09-May 09

Re: edit listview item?

Posted 05 December 2011 - 10:46 AM

Im not sure how i would use these events.

If i use listview1.enter then the listview is in edit mode, i need the selected item in edit mode.

ListView1.SelectedItems(0).BeginEdit()

the code above does not work for the edit. Is there an event for selected item?

Kevin
Was This Post Helpful? 0
  • +
  • -

#4 AdamSpeight2008  Icon User is offline

  • MrCupOfT
  • member icon


Reputation: 2270
  • View blog
  • Posts: 9,496
  • Joined: 29-May 08

Re: edit listview item?

Posted 05 December 2011 - 10:53 AM

What about defining your own? and raising that.
Private Event FinishedEditing(sender As Object, e As FinishedEditingArgs)



RaiseEvent Me.FinishedEditing(Me,New FinishedEditingArgs())


Was This Post Helpful? 0
  • +
  • -

#5 deery5000  Icon User is offline

  • D.I.C Addict

Reputation: 78
  • View blog
  • Posts: 977
  • Joined: 09-May 09

Re: edit listview item?

Posted 05 December 2011 - 11:12 AM

wish i knew how to do that :)

ill give it a try later see if i can make any progress.
Was This Post Helpful? 0
  • +
  • -

#6 AdamSpeight2008  Icon User is offline

  • MrCupOfT
  • member icon


Reputation: 2270
  • View blog
  • Posts: 9,496
  • Joined: 29-May 08

Re: edit listview item?

Posted 05 December 2011 - 11:21 AM

Jebus H Corbit do want me press the keyboard keys and move the mouse as well.

VB.Net Tutorials -> Understanding Events With The Crying Baby Example

The Event's are simply a class that inherits from EventArgs
Was This Post Helpful? 0
  • +
  • -

#7 deery5000  Icon User is offline

  • D.I.C Addict

Reputation: 78
  • View blog
  • Posts: 977
  • Joined: 09-May 09

Re: edit listview item?

Posted 05 December 2011 - 11:25 AM

such a drama queen! lol
Was This Post Helpful? 0
  • +
  • -

#8 AdamSpeight2008  Icon User is offline

  • MrCupOfT
  • member icon


Reputation: 2270
  • View blog
  • Posts: 9,496
  • Joined: 29-May 08

Re: edit listview item?

Posted 05 December 2011 - 11:41 AM

Shuddup you tato munching fairy. :genius:
Was This Post Helpful? 0
  • +
  • -

#9 deery5000  Icon User is offline

  • D.I.C Addict

Reputation: 78
  • View blog
  • Posts: 977
  • Joined: 09-May 09

Re: edit listview item?

Posted 05 December 2011 - 02:47 PM

lol love the banter
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1