Results 1 to 6 of 6

Thread: How To Reapeat [NOT Resolved]

  1. #1

    Thread Starter
    Hyperactive Member StreaksAthlete's Avatar
    Join Date
    Sep 2004
    Posts
    348

    Exclamation How To Reapeat [NOT Resolved]

    Is there a way you can repeat something that just happend.
    Example:
    VB Code:
    1. Private Sub Command1_Click()
    2. ListView1.ListItems.Add 1, , OK, "leaf", "leaf"
    Is There A Way I Can Reapeat The Same Thing?

  2. #2
    yay gay PT Exorcist's Avatar
    Join Date
    Apr 2002
    Location
    . . . my reason of shame
    Posts
    2,729
    using a while or for / next statement?
    \m/\m/

  3. #3
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709
    You mean like adding the same listview item or by pressing the
    command button again?

    VB Code:
    1. 'Repeats 10 times
    2. Private Sub Command1_Click()
    3.     Dim i as integer
    4.     for i = 1 to 10
    5.         ListView1.ListItems.Add , , OK, "leaf", "leaf"
    6.     next
    7. End Sub
    8.  
    9. 'Repeat something that just happened one time.
    10. 'Will take two clicks in order to add a listitem.
    11. Private Sub Command1_Click()
    12.     Static bHappened as Boolean
    13.     bHappened = Not bHappened
    14.     If bHappened = True Then
    15.         ListView1.ListItems.Add , , OK, "leaf", "leaf"
    16.     End If
    17. End Sub
    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

  4. #4

    Thread Starter
    Hyperactive Member StreaksAthlete's Avatar
    Join Date
    Sep 2004
    Posts
    348

    Command Button

    By Pressing The Command Button
    Unity Programs™ - Downloads To Make Your Computer Life Easier - UnityPrograms.com, check it out
    My small company, I need feedback.


    If someone's post was useful, don't forget to Rate It by clicking the Rate This Post link under the avatar.
    If this post has been resolved. Please mark it as Resolved by going through the Thread Tools above and clicking on the Mark Thread Resolved option.
    We ride together, We die together, .NET for life. - Working With Visual Studio.NET 2005

    Application Deployment, General Developer Forum, Visual Basic .NET

  5. #5
    Fanatic Member laserman's Avatar
    Join Date
    Jan 2002
    Location
    Wales U.K
    Posts
    775
    Little example
    Attached Files Attached Files

  6. #6
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709
    I missed some code for my second ex.
    VB Code:
    1. 'Repeat something that just happened with one click.
    2. 'Will take one click but will happen twice.
    3. Private Sub Command1_Click()
    4.     Static bHappened as Boolean
    5.     bHappened = Not bHappened
    6.     If bHappened = True Then
    7.         ListView1.ListItems.Add , , OK, "leaf", "leaf"
    8.     End If
    9.     Call Command1_Click 'Forgot this line
    10. End Sub
    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

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