Click here to Skip to main content
15,885,309 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi I am develop windows application,in that i need to popup progress bar,in button click event i need to show progress bar at center of windows forms application,for example.When start to close progress bar in between code execute 2 to 5 mins ,so that time i need to show one message(like "Please Wait...") to user.In button form already got control,so i cant put progress bar at center of form at design time.


VB
Private Sub BtnCheckin_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnCheckin.Click
'Here need to start to show progress bar

.........................
........................
......................
........................
.........................
........................
......................
........................

'Here need to close progress bar

End Sub


Note: why code ececute 2 to 5 mins,bcz i will bind(more than 10000) node to treeview,so it take 2 to 5 mins to bind node in treeview.

Pls reply asap

Regards
Aravind
Posted
Comments
Maciej Los 5-Nov-14 3:33am    
Your question in title does not corresponds to the question in a body of question. What have you done? WHere are you stuck?
Aravindba 5-Nov-14 3:35am    
i need show progress bar as popup in windows application, How ?

1 solution

Please, read my comment first.
Have a look here: http://www.experts-exchange.com/Programming/Languages/.NET/Q_23786595.html[^]

In case you're not able to view the solution, please see:
C#
//--BEGIN
//  In my main section of the 'main form'
            pb.Style = ProgressBarStyle.Marquee;
            pb.MarqueeAnimationSpeed = 30;

        private BackgroundWorker worker = null;
        worker = new BackgroundWorker();
        worker.DoWork +=new DoWorkEventHandler(worker_DoWork);
        worker.RunWorkerAsync();
//---END

        void worker_DoWork(object sender, DoWorkEventArgs e)
        {
            BuildTree();
        }


The concept is to use BackgroudWorker.
http://www.c-sharpcorner.com/UploadFile/LivMic/BGWorker07032007000515AM/BGWorker.aspx[^]

If you would like to show form with progressbarr on the center of parent form, use proper StartPosition[^] or Location.

How to: Set the Screen Location of Windows Forms[^]
 
Share this answer
 
v2
Comments
Aravindba 5-Nov-14 3:50am    
Thank you for ur reply,actually my problem is same as first link,i will show progress progress bar in another form.And i know start position and screen location.If Progress bar in same page ,then how to show in center of form ? bcz,user may be minimize or maximize window that time need to show at center.
And one thing in first link what they did .like that i create,but progress bar animation not show and also,if click F5 then that progress bar appear.
Maciej Los 5-Nov-14 3:56am    
"If Progress bar in same page ,then how to show in center of form ?" - I don't understand you. If you use Windows Forms, what you mean by 'page'?
"i know start position and screen location" - if you know it, so what kind of issue do you have?
Aravindba 5-Nov-14 4:49am    
if progress bar in same form,then how to show at center of form ?Actually in asp.net we show progress bar using modal popup,like that i need to show progress bar as center of form,In form load event i will set progress bar visible as false,if click button then only i show progress bar,so how to show like this ? in windows we show progress bar at bottom of form ,like that i dont want,i need to show progress bar at center.
Pls see this link http://prntscr.com/537tph,it will show progress bar as another form,and not show animation like loading color,if run progress bar form only then show animation.
Maciej Los 5-Nov-14 7:34am    
Divide the height of form per 2 and add a half of height progressbar control. The same you should do with width. Finally, set the visibility of progressbar to true.
Simple?
Aravindba 5-Nov-14 21:02pm    
Thank you for your reply,i already did like that,but progress bar not appear,What i did is,in design time i will put progress bar on the form and set visible as False,then in button click event i will take form width and height and divide with 2 ,i set location with half of the height and width,but when i run application,progress bar not appear.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900