PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197

PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197

PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197

PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197
Progress Bar while loading another form-VBForums
Results 1 to 16 of 16

Thread: Progress Bar while loading another form

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jul 2001
    Location
    Earth
    Posts
    277

    Progress Bar while loading another form

    Hi

    I have two forms, Form1, Form2

    I use a CommandButton to move from one form to another.

    I use this code:
    VB Code:
    1. Form2.Show
    2. Me.Hide
    This code works fine but the second form doesn't show up instantly because there is alot of code in its Form_Load event.

    Is there any way to display for example a progress bar while loading the other form and then show up the form when its load completes.

    Thanks

  2. #2
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: Progress Bar while loading another form

    Put the events into the Form_Activate section. Place a label at the start, that disapears at the end of the loading.
    VB Code:
    1. label1.caption = "One moment, please..."

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Jul 2001
    Location
    Earth
    Posts
    277

    Re: Progress Bar while loading another form

    I already put the code in Form_Activate() but the form hangs for a while and then it shows up

  4. #4
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: Progress Bar while loading another form

    Put the code in a sub, and call it from form_activate? that should show it first.

  5. #5
    VB Addict Pradeep1210's Avatar
    Join Date
    Apr 2004
    Location
    Inside the CPU...
    Posts
    6,600

    Re: Progress Bar while loading another form

    Add a third form to your project (named frmWait). Add label etc. to that form to show whatever message you want to show to user while he waits.
    And modify the load event of your Form2 as follows:
    VB Code:
    1. Private Sub Form_Load()
    2.     frmWait.Show , Me
    3.     frmWait.Refresh
    4.     '
    5.     '
    6.     ' Your other code here
    7.     '
    8.     '
    9.     Unload frmWait
    10. End Sub
    Pradeep, Microsoft MVP (Visual Basic)
    Please appreciate posts that have helped you by clicking icon on the left of the post.
    "A problem well stated is a problem half solved." — Charles F. Kettering

    Read articles on My Blog101 LINQ SamplesJSON ValidatorXML Schema Validator"How Do I" videos on MSDNVB.NET and C# ComparisonGood Coding PracticesVBForums Reputation SaverString EnumSuper Simple Tetris Game


    (2010-2013)
    NB: I do not answer coding questions via PM. If you want my help, then make a post and PM me it's link. If I can help, trust me I will...

  6. #6

    Thread Starter
    Hyperactive Member
    Join Date
    Jul 2001
    Location
    Earth
    Posts
    277

    Re: Progress Bar while loading another form

    Thanks Pradeep.

    I appreciate ur help.

  7. #7
    Member
    Join Date
    Nov 2017
    Posts
    32

    Re: Progress Bar while loading another form

    Quote Originally Posted by Pradeep1210 View Post
    Add a third form to your project (named frmWait). Add label etc. to that form to show whatever message you want to show to user while he waits.
    And modify the load event of your Form2 as follows:
    VB Code:
    1. Private Sub Form_Load()
    2.     frmWait.Show , Me
    3.     frmWait.Refresh
    4.     '
    5.     '
    6.     ' Your other code here
    7.     '
    8.     '
    9.     Unload frmWait
    10. End Sub
    why the code is not working with me on visual studio 2012 ?

  8. #8
    PowerPoster
    Join Date
    Oct 2013
    Posts
    3,166

    Re: Progress Bar while loading another form

    Because vb.net is not the same as vb6!

  9. #9
    Member
    Join Date
    Nov 2017
    Posts
    32

    Re: Progress Bar while loading another form

    Quote Originally Posted by Arnoutdv View Post
    Because vb.net is not the same as vb6!
    would you please help in vb.net as I badly need it PLEASE

  10. #10
    PowerPoster SamOscarBrown's Avatar
    Join Date
    Aug 2012
    Location
    NC, USA
    Posts
    6,508

    Re: Progress Bar while loading another form

    Best this Thread get posted in the VB.NET part of this Forum...MORE users of that app there. I'll report to the Moderators to ask if they will move it for you.

  11. #11
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    31,784

    Re: Progress Bar while loading another form

    No, don't... he's already got a thread... and is getting bad advice from it. Got one post that has a decent answer, is choosing to ignore it.

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  12. #12
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    32,391

    Re: Progress Bar while loading another form

    Okaaay. Shall I take bids?

    This is a really old thread. Advice in this thread was for VB6, and will not necessarily apply to VS2012, which is .NET. Since there is already a thread over there, and since nothing meaningful has happened in this thread except that which was thirteen years ago, this might as well remain here. I'm tempted to close it, but that probably isn't justified.
    My usual boring signature: Nothing

  13. #13
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    4,579

    Re: Progress Bar while loading another form

    vbuser99,

    I know the answer, and it's a good one too. Rewrite the rest of your app in VB6. That way, you can come over here and get advice that'll actually help you.

    Take Care,
    Elroy
    Any software I post in these forums written by me is provided “AS IS” without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. Please understand that I’ve been programming since the mid-1970s and still have some of that code. My contemporary VB6 project is approaching 1,000 modules. In addition, I have a “VB6 random code folder” that is overflowing. I’ve been at this long enough to truly not know with absolute certainty from whence every single line of my code has come, with much of it coming from programmers under my employ who signed intellectual property transfers. I have not deliberately attempted to remove any licenses and/or attributions from any software. If someone finds that I have inadvertently done so, I sincerely apologize, and, upon notice and reasonable proof, will re-attach those licenses and/or attributions. To all, peace and happiness.

  14. #14
    Frenzied Member ChrisE's Avatar
    Join Date
    Jun 2017
    Location
    Frankfurt
    Posts
    1,236

    Re: Progress Bar while loading another form

    Quote Originally Posted by Elroy View Post
    vbuser99,

    I know the answer, and it's a good one too. Rewrite the rest of your app in VB6. That way, you can come over here and get advice that'll actually help you.

    Take Care,
    Elroy
    LOL

    regards
    Chris
    to hunt a species to extinction is not logical !
    since 2010 the number of Tigers are rising again in 2016 - 3900 were counted. with Baby Callas it's 3901, my wife and I had 2-3 months the privilege of raising a Baby Tiger.

  15. #15
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    4,579

    Re: Progress Bar while loading another form

    Hey, Microsoft seems to be leaving VB.NET behind as they did VB6, so maybe all the VB netters will come on home to VB6 where they belong.
    Any software I post in these forums written by me is provided “AS IS” without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. Please understand that I’ve been programming since the mid-1970s and still have some of that code. My contemporary VB6 project is approaching 1,000 modules. In addition, I have a “VB6 random code folder” that is overflowing. I’ve been at this long enough to truly not know with absolute certainty from whence every single line of my code has come, with much of it coming from programmers under my employ who signed intellectual property transfers. I have not deliberately attempted to remove any licenses and/or attributions from any software. If someone finds that I have inadvertently done so, I sincerely apologize, and, upon notice and reasonable proof, will re-attach those licenses and/or attributions. To all, peace and happiness.

  16. #16
    You don't want to know.
    Join Date
    Aug 2010
    Posts
    4,580

    Re: Progress Bar while loading another form

    The VB .NETters who matter are either already using C# or completely moved on to other platforms years ago. You don't want the ones who are starting new projects in VB .NET. Trust me.

    They're the kind of people that create a thread that goes like:

    "Hi, I'm doing a lot of work on the UI thread and my form freezes what do?"

    > "You should do that work on a worker thread so the UI can display progress updates."

    "OK, I put an animated GIF on the form but it freezes???"

    >

    "Tell you what, I'll go ask the VB6 guys."
    This answer is wrong. You should be using TableAdapter and Dictionaries instead.

Posting Permissions

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



Featured


Click Here to Expand Forum to Full Width