2015-09-08 75 views
0

我有2個表:如何在寫入登錄表單時點擊按鈕?

Form1中:節目表2和寫日誌Form2上

Public Class Form1 

     Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click 
      Dim frm2 As New Form2 
      frm2.Show() 
      For i = 0 To 100000 
       frm2.setLog(i.ToString) 
      Next 
     End Sub 
    End Class 

窗體2:

Public Class Form2 
     Dim bLog As Boolean = True 
     Public Sub setLog(ByVal msg As String) 
      If bLog Then 
       Label1.Text = msg 
      End If 
     End Sub 

     Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click 
      bLog = False 
     End Sub 
    End Class 

如何可以點擊窗體2按鈕 「Button2的」? 謝謝大家。

回答

2

在C#中,在你的setLog函數中調用Application.DoEvents()。

+0

是的,沒關係。謝謝。 –

相關問題