VB进度条的使用
答案:3 悬赏:10 手机版
解决时间 2021-02-21 07:46
- 提问者网友:抽煙菂渘情少年
- 2021-02-20 22:56
做了一个VB,想在里面加一个进度点,点击Command后,显示正在执行,当进度条完了,显示连接失败,然后原窗口关闭,请问高人怎么添加其中的代码?谢谢了!急急。。。。。
最佳答案
- 五星知识达人网友:从此江山别
- 2021-02-20 23:42
'新建工程,添加一滚动条,一标签,一计时器,一按钮,直接复制代码即可
Dim Ss As Integer
Private Sub Command1_Click()
Me.Timer1.Enabled = True
Me.Label1.Caption = "正在执行。。。"
End Sub
Private Sub Form_Load()
Me.Timer1.Interval = 100
Me.Timer1.Enabled = False
Me.ProgressBar1.Scrolling = ccScrollingSmooth
Me.ProgressBar1.Max = 100
Me.ProgressBar1.Min = 0
End Sub
Private Sub Timer1_Timer()
Ss = Ss + 1
If Ss = 100 Then
Me.Label1.Caption = "连接失败!"
ElseIf Ss = 110 Then
Me.Timer1.Enabled = False
Unload Me
ElseIf Ss <= 100 Then
Me.ProgressBar1.Value = Ss
End If
End Sub
其实这是个简单的问题,但回答总要花时间和精力.你如果多少给点分有点表示的话我想早就有人为你解决了
Dim Ss As Integer
Private Sub Command1_Click()
Me.Timer1.Enabled = True
Me.Label1.Caption = "正在执行。。。"
End Sub
Private Sub Form_Load()
Me.Timer1.Interval = 100
Me.Timer1.Enabled = False
Me.ProgressBar1.Scrolling = ccScrollingSmooth
Me.ProgressBar1.Max = 100
Me.ProgressBar1.Min = 0
End Sub
Private Sub Timer1_Timer()
Ss = Ss + 1
If Ss = 100 Then
Me.Label1.Caption = "连接失败!"
ElseIf Ss = 110 Then
Me.Timer1.Enabled = False
Unload Me
ElseIf Ss <= 100 Then
Me.ProgressBar1.Value = Ss
End If
End Sub
其实这是个简单的问题,但回答总要花时间和精力.你如果多少给点分有点表示的话我想早就有人为你解决了
全部回答
- 1楼网友:爱难随人意
- 2021-02-21 01:13
用一个标签来显示“正在执行”
进度条完了后,显示“连接失败”
me.hide
- 2楼网友:青灯有味
- 2021-02-21 00:37
添加两个cmd控件 一个进度条控件
添加下面代码试试
dim i, a as long
private sub command1_click()
if a = 1 then end
command1.caption = "ing..."
progressbar1.min = 0
progressbar1.max = 5000
for i = 0 to 5000 step 1
progressbar1.value = i
command2.caption = int(i * 100 / 5000) & "%"
next
command2.enabled = false
a = a + 1
command1.caption = "out"
end sub
private sub form_load()
command1.caption = "star"
end sub
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯