进度栏在Windows应用程序中不起作用 [英] Progress bar not working in windows application

查看:89
本文介绍了进度栏在Windows应用程序中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

正在研究vb.net 2008应用程序.首先在名为SM_Progress.vb的表单上创建.在那我添加了进度条控件并设置了merqueryAnimationspeed30.我又创建了一个Windows窗体,并添加了两个按钮以及一个文本框和文件夹browser.现在对我来说,我想在单击一个按钮时显示SM_progress表单.我在click事件中编写了这样的代码.

Hi all,

am working on vb.net 2008 application. First am created on Form called SM_Progress.vb. In that i added the progress bar control and set merqueryAnimationspeed 30. Am created one more windows form and added two button and one textbox and folder browsingDialog. Now for me i want show the SM_progress form when am clicking the one button. i wrote the code like this in click event.

SM_Progress.Show()
Application.DoEvents()


它仅显示表单.Progress bar不会旋转..如何在按钮click事件中执行特定操作的进度条.?


Its only showing the form .Progress bar is not rotating.. How can i run the progress bar for particular operation done in the button click event.?

推荐答案

设置样式?
Have you set the Style?
myProgressBar.Style = ProgressBarStyle.Marquee;

应该做到这一点.


要显示ProgressBar的工作状态,您必须使用Timer控件.在Timer_Tick事件中Timer控件的代码编写以下代码:
To show ProgressBar working you have to use Timer control.On Timer_Tick event of Timer control write the following code :
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        ProgressBar1.Value = ProgressBar1.Value + 1
End Sub


现在在打开SM_Progress Form的Button上编写以下代码:


Now write following code on Button where you open SM_Progress Form :

Timer1.Interval = 100
Timer1.Enable = True
Timer.Start()


希望对您有帮助. :)


I hope it will help you. :)


这篇关于进度栏在Windows应用程序中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆