当前位置:编程学习 > VB >>

急急!出现死循环!大家快来帮帮我

我是想要能过进度条,然后进入第二个窗体,但是出现了死循环:
        ProgressBar1.Value = i
        Dim frm2 As New Form2
        i = i + 1
        If i = 100 Then

            frm2.Show()
        End If
求救!! --------------------编程问答--------------------
引用楼主 IAMAK47 的帖子:
我是想要能过进度条,然后进入第二个窗体,但是出现了死循环: 
        ProgressBar1.Value = i 
        Dim frm2 As New Form2 
        i = i + 1 
        If i = 100 Then 

            frm2.Show() 
        End If 
求救!!


   晕,发到VB板块吧!这是VC/MFC的。 --------------------编程问答-------------------- 你这个循环根本没有退出啊

load frm2
frm2.show
exit sub/function ??? --------------------编程问答-------------------- 要怎样改?帮帮,我刚学VB谢谢 --------------------编程问答-------------------- 你要给出整个 sub/function 代码 --------------------编程问答-------------------- Public Class Form3
    Inherits System.Windows.Forms.Form
    Dim i As Integer


Private Sub Form3_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Timer1.Enabled = True
    End Sub

    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        ProgressBar1.Value = i
        Dim frm2 As New Form2
        i = i + 1
        If i = 100 Then

            frm2.Show()
        End If
    End Sub --------------------编程问答-------------------- If i = 100 Then
    Timer1.Enable = false  // 好久没碰VB了,不知道是不是这么写
            frm2.Show()
        End If  --------------------编程问答-------------------- .net都过来了……
楼上正解。 --------------------编程问答-------------------- 结帖吧......

        
--------------------编程问答--------------------

            Timer1.Enable = false  ,七楼说的对,加了这条代码就可以了阿
        
--------------------编程问答--------------------

            循环在哪里?
看你贴出的代码,你的窗体永远也不会弹出
补充:VB ,  基础类
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,