2016-08-22 42 views
-1

在我的計劃,我要檢查,如果當我的進度條完成我的應用程序被註冊。如果它是註冊的(通過表格1中標籤的文本檢查)第二個文本框應該出現,如果沒有註冊第一個文本框應該出現我需要一些修正VB.net代碼框架2.0製作登記制度

問題是我必須添加結尾if當我不'不想要,因爲它會不斷彈出文本框。

這是我的代碼:

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick 
    ProgressBar1.Value += 1 
    If ProgressBar1.Value = 
    ProgressBar1.Maximum Then 
     Timer1.Stop() 
     ProgressBar1.Value = ProgressBar1.Minimum 
     If Form1.Label4.Text = "Unregistered" Then 
     MsgBox("Exampletext", MsgBoxStyle.Information) 
     Me.Hide() 
    Else 
     MsgBox("Exampletext1", MsgBoxStyle.Information) 
     Hide() 
    End If 
End Sub 
End Class 

BTW:我沒有想讓它在framework 2.0,但我做到了,使其與老版本的Windows更兼容。

+0

你的問題並沒有真正意義。我不知道你實際要求什麼。請嘗試編輯您的問題並提供問題的完整和清晰描述。 – jmcilhinney

+0

我編輯有點 –

+0

我將關閉一小時,所以如果你想回答,我會看到所有的答案,然後 –

回答

0

這就是爲什麼正確的縮進是重要的......

編譯器認爲,Else是關係到第一If

而實際上,將不會發生什麼,當你第二If是正確的,因爲沒有End If。因此,假設該指令位於同一行。

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick 
ProgressBar1.Value += 1 
    If ProgressBar1.Value = ProgressBar1.Maximum Then 
     Timer1.Stop() 
     ProgressBar1.Value = ProgressBar1.Minimum 
     If Form1.Label4.Text = "Unregistered" Then 
      MsgBox("Exampletext", MsgBoxStyle.Information) 
      Me.Hide() 
     Else 
      MsgBox("Exampletext1", MsgBoxStyle.Information) 
      Hide() 
     End If 
    End If 'You need to add the End If here 
End Sub 

但是我投票,因爲它是一個錯字錯誤關閉這個問題...

+0

謝謝我的問題現在已經解決了:)有一個愉快的一天:) –

+0

請註明這個答案是通過點擊正確的答案上的勾號。 –

+0

@MichaelSelvesakis請點擊答案上的勾號標記此答案爲正確答案。 –