Results 1 to 7 of 7

Thread: ListView LabelEdit

  1. #1

    Thread Starter
    Fanatic Member cpatzer's Avatar
    Join Date
    Sep 2004
    Posts
    537

    ListView LabelEdit

    Hello,

    I have a ListView that "after" a label edit I need to add spaces to the beginning of the file name. My problem is that any code ran in the AfterLabelEdit event actually takes place before the ListViews own LabelEdit logic updates the text of the ListViewItem.

    So...

    1) User edits label
    2) I assign the text
    3) AfterLabelEdit changes the text back after the exiting the event from my side.

    The only thing I can think of at this point is to set a timer at the end of the AfterLabelEdit event to set the text to what I want it. Seems like a pretty lame solution to me.

    Any suggestions?

    Thanks in advance,

    Christian
    In life you can be sure of only two things... death and taxes. I'll take death.

  2. #2
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: ListView LabelEdit

    What if you perform the label edit manually or Override the listview events?
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  3. #3

    Thread Starter
    Fanatic Member cpatzer's Avatar
    Join Date
    Sep 2004
    Posts
    537

    Re: ListView LabelEdit

    Not sure what you mean by manually.

    Haven't tried overriding the listview event. Don't I have to create my own inherited ListView object to do that? Or is there an easier way?
    In life you can be sure of only two things... death and taxes. I'll take death.

  4. #4
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: ListView LabelEdit

    Yes, you would have to inherit the listview.

    Manually, I mean calling the .StartLabelEdit in code and not sure if it would be called modally, but if it is then you could call your update fix after on the next line of c0d.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  5. #5

    Thread Starter
    Fanatic Member cpatzer's Avatar
    Join Date
    Sep 2004
    Posts
    537

    Re: ListView LabelEdit

    Yea,

    I do call it manually:

    ListViewItem.BeginEdit()

    Then I have an event handler:

    ListView_AfterLabelEdit


    Problem is the text is updated by the ListView after the exit of the ListView_AfterLabelEdit even handler. Not exactly intuitive.

    The code execution does not pause after BeginEdit() so the next line thing wont work.

    Thanks.
    In life you can be sure of only two things... death and taxes. I'll take death.

  6. #6
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: ListView LabelEdit

    Then I can only think of using a timer or inheriting the listview for an overrride.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  7. #7

    Thread Starter
    Fanatic Member cpatzer's Avatar
    Join Date
    Sep 2004
    Posts
    537

    Re: ListView LabelEdit

    Thanks for all your help RobDog.
    In life you can be sure of only two things... death and taxes. I'll take death.

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